Trim crio prefix, dedup results

pull/7136/head
Thomas Stromberg 2020-03-21 10:47:08 -07:00
parent 75f2f914db
commit e6948b90b4
1 changed files with 9 additions and 3 deletions

View File

@ -260,12 +260,14 @@ func testPulledImages(ctx context.Context, t *testing.T, profile string, version
if err != nil {
t.Errorf("images unmarshal: %v", err)
}
gotImages := []string{}
found := map[string]bool{}
for _, img := range jv["images"] {
for _, i := range img.Tags {
// Remove container-specific prefixes for naming consistency
i = strings.TrimPrefix(i, "docker.io/")
i = strings.TrimPrefix(i, "localhost/")
if defaultImage(i) {
// Remove docker.io for naming consistency between container runtimes
gotImages = append(gotImages, strings.TrimPrefix(i, "docker.io/"))
found[i] = true
} else {
t.Logf("Found non-minikube image: %s", i)
}
@ -275,6 +277,10 @@ func testPulledImages(ctx context.Context, t *testing.T, profile string, version
if err != nil {
t.Errorf("kubeadm images: %v", version)
}
gotImages := []string{}
for k := range found {
gotImages = append(gotImages, k)
}
sort.Strings(want)
sort.Strings(gotImages)
if diff := cmp.Diff(want, gotImages); diff != "" {