Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: Fix VerifyKubernetesImages on Kubernetes versions before v1.24 with docker cruntime #17647

Merged
merged 3 commits into from
Nov 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions test/integration/start_stop_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,29 +352,33 @@ func testPulledImages(ctx context.Context, t *testing.T, profile, version string
t.Helper()
defer PostMortemLogs(t, profile)

rr, err := Run(t, exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "sudo crictl images -o json"))
// TODO(prezha): once we bump the minimum supported k8s version to v1.24+
// (where dockershim is deprecated, while cri-tools we use support cri v1 api),
// we can revert back to the "crictl" to check images here - eg:
// rr, err := Run(t, exec.CommandContext(ctx, Target(), "ssh", "-p", profile, "sudo crictl images -o json"))
rr, err := Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "image", "list", "--format=json"))
if err != nil {
t.Errorf("failed to get images inside minikube. args %q: %v", rr.Command(), err)
}
jv := map[string][]struct {
jv := []struct {
Tags []string `json:"repoTags"`
}{}

stdout := rr.Stdout.String()

err = json.Unmarshal([]byte(stdout), &jv)
if err != nil {
if err := json.Unmarshal([]byte(stdout), &jv); err != nil {
t.Errorf("failed to decode images json %v. output:\n%s", err, stdout)
}

found := map[string]bool{}
for _, img := range jv["images"] {
for _, img := range jv {
for _, i := range img.Tags {
i = trimImageName(i)
if defaultImage(i) {
found[i] = true
} else {
t.Logf("Found non-minikube image: %s", i)
continue
}
t.Logf("Found non-minikube image: %s", i)
}
}

Expand Down
Loading