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 <nemadedeepak1111@gmail.com>pull/21571/head
parent
574f958887
commit
1bc33a8ff9
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue