From 230db92f01c259b2bf9eaf34cda68306df60e927 Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Wed, 29 Nov 2023 08:52:15 +0100 Subject: [PATCH] Remove K0sUpdateVersion from BootlooseSuite 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 --- inttest/ap-ha3x3/ha3x3_test.go | 8 ++++++-- inttest/common/bootloosesuite.go | 8 -------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/inttest/ap-ha3x3/ha3x3_test.go b/inttest/ap-ha3x3/ha3x3_test.go index 3b052cee1a4b..7d07ebb09b3a 100644 --- a/inttest/ap-ha3x3/ha3x3_test.go +++ b/inttest/ap-ha3x3/ha3x3_test.go @@ -16,6 +16,7 @@ package ha3x3 import ( "fmt" + "os" "strings" "testing" "time" @@ -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 @@ -102,7 +106,7 @@ spec: timestamp: now commands: - k0supdate: - version: ` + s.K0sUpdateVersion + ` + version: ` + k0sUpdateVersion + ` platforms: linux-amd64: url: http://localhost/dist/k0s-new @@ -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") diff --git a/inttest/common/bootloosesuite.go b/inttest/common/bootloosesuite.go index 68dcab415bda..47f0dc9f0345 100644 --- a/inttest/common/bootloosesuite.go +++ b/inttest/common/bootloosesuite.go @@ -75,8 +75,6 @@ const ( k0sBindMountFullPath = "/dist/k0s" k0sNewBindMountFullPath = "/dist/k0s-new" - defaultK0sUpdateVersion = "v0.0.0" - defaultBootLooseImage = "bootloose-alpine" ) @@ -102,7 +100,6 @@ type BootlooseSuite struct { WorkerCount int K0smotronWorkerCount int WithUpdateServer bool - K0sUpdateVersion string BootLooseImage string ctx context.Context @@ -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}