From 1bc33a8ff9e67b18ee0cb24ec40d104b8840df8f Mon Sep 17 00:00:00 2001 From: DeepDN Date: Mon, 15 Sep 2025 20:17:12 +0530 Subject: [PATCH] test: Remove duplicate kubernetes versions in tests Replace manual deduplication logic in aaa_download_only_test.go with util.RemoveDuplicateStrings() function for better consistency and maintainability. Previously, when DefaultKubernetesVersion and NewestKubernetesVersion had the same value (currently both v1.34.0), tests would run twice for the same version. The manual check and slice manipulation has been replaced with the existing utility function that handles deduplication more robustly. Fixes #21483 Signed-off-by: DeepDN --- test/integration/aaa_download_only_test.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/test/integration/aaa_download_only_test.go b/test/integration/aaa_download_only_test.go index e401eddc6a..bf99b2f2b5 100644 --- a/test/integration/aaa_download_only_test.go +++ b/test/integration/aaa_download_only_test.go @@ -39,6 +39,7 @@ import ( "k8s.io/minikube/pkg/minikube/constants" "k8s.io/minikube/pkg/minikube/download" "k8s.io/minikube/pkg/minikube/localpath" + "k8s.io/minikube/pkg/util" ) // TestDownloadOnly makes sure the --download-only parameter in minikube start caches the appropriate images and tarballs. @@ -58,16 +59,11 @@ func TestDownloadOnly(t *testing.T) { // nolint:gocyclo containerRuntime := ContainerRuntime() - versions := []string{ + versions := util.RemoveDuplicateStrings([]string{ constants.OldestKubernetesVersion, constants.DefaultKubernetesVersion, constants.NewestKubernetesVersion, - } - - // Small optimization, don't run the exact same set of tests twice - if constants.DefaultKubernetesVersion == constants.NewestKubernetesVersion { - versions = versions[:len(versions)-1] - } + }) for _, v := range versions { t.Run(v, func(t *testing.T) {