diff --git a/test/integration/functional_test.go b/test/integration/functional_test.go index f4f4244c8c..d49b6b9d17 100644 --- a/test/integration/functional_test.go +++ b/test/integration/functional_test.go @@ -245,27 +245,6 @@ func validateNodeLabels(ctx context.Context, t *testing.T, profile string) { } } -// tagAndLoadImage is a helper function to pull, tag, load image (decreases cyclomatic complexity for linter). -func tagAndLoadImage(ctx context.Context, t *testing.T, profile, taggedImage string) { - newPulledImage := fmt.Sprintf("%s:%s", echoServerImage, "latest") - rr, err := Run(t, exec.CommandContext(ctx, "docker", "pull", newPulledImage)) - if err != nil { - t.Fatalf("failed to setup test (pull image): %v\n%s", err, rr.Output()) - } - - rr, err = Run(t, exec.CommandContext(ctx, "docker", "tag", newPulledImage, taggedImage)) - if err != nil { - t.Fatalf("failed to setup test (tag image) : %v\n%s", err, rr.Output()) - } - - rr, err = Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "image", "load", "--daemon", taggedImage, "--alsologtostderr")) - if err != nil { - t.Fatalf("loading image into minikube from daemon: %v\n%s", err, rr.Output()) - } - - checkImageExists(ctx, t, profile, taggedImage) -} - // runImageList is a helper function to run 'image ls' command test. func runImageList(ctx context.Context, t *testing.T, profile, testName, format, expectedFormat string) { expectedResult := expectedImageFormat(expectedFormat) @@ -388,7 +367,23 @@ func validateImageCommands(ctx context.Context, t *testing.T, profile string) { // docs: Make sure a new updated tag works by `minikube image load --daemon` t.Run("ImageTagAndLoadFromDaemon", func(t *testing.T) { - tagAndLoadImage(ctx, t, profile, taggedImage) + newPulledImage := fmt.Sprintf("%s:%s", echoServerImage, "latest") + rr, err := Run(t, exec.CommandContext(ctx, "docker", "pull", newPulledImage)) + if err != nil { + t.Fatalf("failed to setup test (pull image): %v\n%s", err, rr.Output()) + } + + rr, err = Run(t, exec.CommandContext(ctx, "docker", "tag", newPulledImage, taggedImage)) + if err != nil { + t.Fatalf("failed to setup test (tag image) : %v\n%s", err, rr.Output()) + } + + rr, err = Run(t, exec.CommandContext(ctx, Target(), "-p", profile, "image", "load", "--daemon", taggedImage, "--alsologtostderr")) + if err != nil { + t.Fatalf("loading image into minikube from daemon: %v\n%s", err, rr.Output()) + } + + checkImageExists(ctx, t, profile, taggedImage) }) // docs: Make sure image saving works by `minikube image load --daemon`