Skip to content

Commit bb4d29b

Browse files
authored
Merge pull request kubernetes#23521 from adisivaprasad/test-dedupe-k8s-versions
test: dedupe kubernetes versions in download-only test
2 parents 9bf103b + 1c2505c commit bb4d29b

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

test/integration/aaa_download_only_test.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
"os/exec"
3232
"path/filepath"
3333
"runtime"
34+
"slices"
3435
"strings"
3536
"testing"
3637

@@ -67,10 +68,15 @@ func TestDownloadOnly(t *testing.T) { // nolint:gocyclo
6768
constants.NewestKubernetesVersion,
6869
}
6970

70-
// Small optimization, don't run the exact same set of tests twice
71-
if constants.DefaultKubernetesVersion == constants.NewestKubernetesVersion {
72-
versions = versions[:len(versions)-1]
71+
// Remove duplicate versions, preserving order. Right now Default and
72+
// Newest are the same, so we would otherwise run the same test twice.
73+
deduped := make([]string, 0, len(versions))
74+
for _, v := range versions {
75+
if !slices.Contains(deduped, v) {
76+
deduped = append(deduped, v)
77+
}
7378
}
79+
versions = deduped
7480

7581
for _, v := range versions {
7682
t.Run(v, func(t *testing.T) {

0 commit comments

Comments
 (0)