Merge pull request #13393 from spowelljr/fixImageList

CI: `ImageList` use image that is available immediately
pull/13455/head
Medya Ghazizadeh 2022-01-24 15:45:10 -08:00 committed by GitHub
commit 66e99697b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 5 deletions

View File

@ -247,7 +247,9 @@ func tagAndLoadImage(ctx context.Context, t *testing.T, profile, taggedImage str
}
// runImageList is a helper function to run 'image ls' command test.
func runImageList(ctx context.Context, t *testing.T, profile, testName, format string, expectedResult []string) {
func runImageList(ctx context.Context, t *testing.T, profile, testName, format, expectedFormat string) {
expectedResult := expectedImageFormat(expectedFormat)
// docs: Make sure image listing works by `minikube image ls`
t.Run(testName, func(t *testing.T) {
MaybeParallel(t)
@ -272,6 +274,13 @@ func runImageList(ctx context.Context, t *testing.T, profile, testName, format s
})
}
func expectedImageFormat(format string) []string {
return []string{
fmt.Sprintf(format, "k8s.gcr.io/pause"),
fmt.Sprintf(format, "k8s.gcr.io/kube-apiserver"),
}
}
// validateImageCommands runs tests on all the `minikube image` commands, ex. `minikube image load`, `minikube image list`, etc.
func validateImageCommands(ctx context.Context, t *testing.T, profile string) {
// docs(skip): Skips on `none` driver as image loading is not supported
@ -283,10 +292,10 @@ func validateImageCommands(ctx context.Context, t *testing.T, profile string) {
t.Skip("skipping on darwin github action runners, as this test requires a running docker daemon")
}
runImageList(ctx, t, profile, "ImageListShort", "short", []string{"k8s.gcr.io/pause", "docker.io/kubernetesui/dashboard"})
runImageList(ctx, t, profile, "ImageListTable", "table", []string{"| k8s.gcr.io/pause", "| docker.io/kubernetesui/dashboard"})
runImageList(ctx, t, profile, "ImageListJson", "json", []string{"[\"k8s.gcr.io/pause", "[\"docker.io/kubernetesui/dashboard"})
runImageList(ctx, t, profile, "ImageListYaml", "yaml", []string{"- k8s.gcr.io/pause", "- docker.io/kubernetesui/dashboard"})
runImageList(ctx, t, profile, "ImageListShort", "short", "%s")
runImageList(ctx, t, profile, "ImageListTable", "table", "| %s")
runImageList(ctx, t, profile, "ImageListJson", "json", "[\"%s")
runImageList(ctx, t, profile, "ImageListYaml", "yaml", "- %s")
// docs: Make sure image building works by `minikube image build`
t.Run("ImageBuild", func(t *testing.T) {