Add new functional test for ListImages as well

pull/11248/head
Anders F Björklund 2021-05-01 13:45:13 +02:00
parent 6f236a0655
commit 6012a8f61d
2 changed files with 35 additions and 1 deletions

View File

@ -84,6 +84,9 @@ validateRemoveImage makes sures that `minikube image rm` works as expected
#### validateBuildImage
validateBuildImage makes sures that `minikube image build` works as expected
#### validateListImages
validateListImages makes sures that `minikube image ls` works as expected
#### validateDockerEnv
check functionality of minikube after evaling docker-env
@ -348,4 +351,4 @@ TestKubernetesUpgrade upgrades Kubernetes from oldest to newest
## TestMissingContainerUpgrade
TestMissingContainerUpgrade tests a Docker upgrade where the underlying container is missing
TEST COUNT: 111
TEST COUNT: 112

View File

@ -135,6 +135,7 @@ func TestFunctional(t *testing.T) {
{"LoadImage", validateLoadImage},
{"RemoveImage", validateRemoveImage},
{"BuildImage", validateBuildImage},
{"ListImages", validateListImages},
}
for _, tc := range tests {
tc := tc
@ -368,6 +369,36 @@ func startBuildkit(ctx context.Context, t *testing.T, profile string) {
}
}
// validateListImages makes sures that `minikube image ls` works as expected
func validateListImages(ctx context.Context, t *testing.T, profile string) {
if NoneDriver() {
t.Skip("list images not available on none driver")
}
if GithubActionRunner() && runtime.GOOS == "darwin" {
t.Skip("skipping on github actions and darwin, as this test requires a running docker daemon")
}
defer PostMortemLogs(t, profile)
// try to list the images with minikube
rr, err := Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "image", "ls"))
if err != nil {
t.Fatalf("listing image with minikube: %v\n%s", err, rr.Output())
}
if rr.Stdout.Len() > 0 {
t.Logf("(dbg) Stdout: %s:\n%s", rr.Command(), rr.Stdout)
}
if rr.Stderr.Len() > 0 {
t.Logf("(dbg) Stderr: %s:\n%s", rr.Command(), rr.Stderr)
}
list := rr.Output()
for _, theImage := range []string{"k8s.gcr.io/pause", "docker.io/kubernetesui/dashboard"} {
if !strings.Contains(list, theImage) {
t.Fatalf("expected %s to be listed with minikube but the image is not there", theImage)
}
}
}
// check functionality of minikube after evaling docker-env
// TODO: Add validatePodmanEnv for crio runtime: #10231
func validateDockerEnv(ctx context.Context, t *testing.T, profile string) {