From 0422dcb939e2ea31e9f584780746eb90ff326b47 Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Wed, 3 Apr 2024 11:40:56 +0200 Subject: [PATCH] Have a constant to indicate Kubernetes pre-releases The pre-releases of Kubernetes have slightly different version strings than the GA versions. Add a simple boolean constant to allow CI to pass on pre-releases. This constant might also get used in other integration tests to modify certain test assumptions. Signed-off-by: Tom Wieczorek --- inttest/kubectl/kubectl_test.go | 6 +++++- pkg/constant/constant.go | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/inttest/kubectl/kubectl_test.go b/inttest/kubectl/kubectl_test.go index a824d046c312..c1de11017275 100644 --- a/inttest/kubectl/kubectl_test.go +++ b/inttest/kubectl/kubectl_test.go @@ -211,8 +211,12 @@ func checkClientVersion(t *testing.T, v map[string]any) { } func checkServerVersion(t *testing.T, v map[string]any) { + expectedVersion := constant.KubernetesMajorMinorVersion + if constant.KubernetesPreRelease { + expectedVersion += "+" + } assert.Equal(t, - constant.KubernetesMajorMinorVersion, + expectedVersion, fmt.Sprintf("%v.%v", requiredValue[string](t, v, "major"), requiredValue[string](t, v, "minor")), ) assert.Contains(t, diff --git a/pkg/constant/constant.go b/pkg/constant/constant.go index 1b735ada3083..35b026d6f39b 100644 --- a/pkg/constant/constant.go +++ b/pkg/constant/constant.go @@ -72,6 +72,8 @@ const ( // KubernetesMajorMinorVersion defines the current embedded major.minor version info KubernetesMajorMinorVersion = "1.29" + // Indicates if k0s is using a Kubernetes pre-release or a GA version. + KubernetesPreRelease = false /* Image Constants */