test: Inline unneeded helper
tagAndLoadDaemon was called once from function doing nothing else. Inline it in the caller.pull/21405/head
parent
7affa76cc5
commit
b2acf957d7
|
|
@ -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.
|
// runImageList is a helper function to run 'image ls' command test.
|
||||||
func runImageList(ctx context.Context, t *testing.T, profile, testName, format, expectedFormat string) {
|
func runImageList(ctx context.Context, t *testing.T, profile, testName, format, expectedFormat string) {
|
||||||
expectedResult := expectedImageFormat(expectedFormat)
|
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`
|
// docs: Make sure a new updated tag works by `minikube image load --daemon`
|
||||||
t.Run("ImageTagAndLoadFromDaemon", func(t *testing.T) {
|
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`
|
// docs: Make sure image saving works by `minikube image load --daemon`
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue