Skip to content

Commit

Permalink
Remove K0sUpdateVersion from BootlooseSuite
Browse files Browse the repository at this point in the history
It is only used once in the Autopilot inttest, so it makes sense to
simply lookup the env var there.

Signed-off-by: Tom Wieczorek <[email protected]>
  • Loading branch information
twz123 committed Nov 29, 2023
1 parent 76cd881 commit 230db92
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 6 additions & 2 deletions inttest/ap-ha3x3/ha3x3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package ha3x3

import (
"fmt"
"os"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -92,6 +93,9 @@ func (s *ha3x3Suite) SetupTest() {
// TestApply applies a well-formed `plan` yaml, and asserts that
// all of the correct values across different objects + controllers are correct.
func (s *ha3x3Suite) TestApply() {
k0sUpdateVersion := os.Getenv("K0S_UPDATE_TO_VERSION")
s.Require().NotEmpty(k0sUpdateVersion, "env var not set or empty: K0S_UPDATE_TO_VERSION")

planTemplate := `
apiVersion: autopilot.k0sproject.io/v1beta2
kind: Plan
Expand All @@ -102,7 +106,7 @@ spec:
timestamp: now
commands:
- k0supdate:
version: ` + s.K0sUpdateVersion + `
version: ` + k0sUpdateVersion + `
platforms:
linux-amd64:
url: http://localhost/dist/k0s-new
Expand Down Expand Up @@ -162,7 +166,7 @@ spec:
}

if version, err := s.GetK0sVersion(s.ControllerNode(0)); s.NoError(err) {
s.Equal(s.K0sUpdateVersion, version)
s.Equal(k0sUpdateVersion, version)
}

out, err = ssh.ExecWithOutput(s.Context(), "/var/lib/k0s/bin/iptables-save -V")
Expand Down
8 changes: 0 additions & 8 deletions inttest/common/bootloosesuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ const (
k0sBindMountFullPath = "/dist/k0s"
k0sNewBindMountFullPath = "/dist/k0s-new"

defaultK0sUpdateVersion = "v0.0.0"

defaultBootLooseImage = "bootloose-alpine"
)

Expand All @@ -102,7 +100,6 @@ type BootlooseSuite struct {
WorkerCount int
K0smotronWorkerCount int
WithUpdateServer bool
K0sUpdateVersion string
BootLooseImage string

ctx context.Context
Expand Down Expand Up @@ -139,11 +136,6 @@ func (s *BootlooseSuite) initializeDefaults() {
s.LaunchMode = LaunchModeStandalone
}

s.K0sUpdateVersion = os.Getenv("K0S_UPDATE_TO_VERSION")
if s.K0sUpdateVersion == "" {
s.K0sUpdateVersion = defaultK0sUpdateVersion
}

switch s.LaunchMode {
case LaunchModeStandalone:
s.launchDelegate = &standaloneLaunchDelegate{s.K0sFullPath, s.ControllerUmask}
Expand Down

0 comments on commit 230db92

Please sign in to comment.