fix TestFunctional/parallel/LoadImageFromFile - 2nd race condition
parent
c39712803a
commit
f1ba75f436
|
|
@ -65,8 +65,6 @@ var mitm *StartSession
|
|||
|
||||
var runCorpProxy = GithubActionRunner() && runtime.GOOS == "linux" && !arm64Platform()
|
||||
|
||||
var imageFile = "busybox.tar"
|
||||
|
||||
// TestFunctional are functionality tests which can safely share a profile in parallel
|
||||
func TestFunctional(t *testing.T) {
|
||||
|
||||
|
|
@ -210,7 +208,6 @@ func cleanupUnwantedImages(ctx context.Context, t *testing.T, profile string) {
|
|||
}
|
||||
})
|
||||
}
|
||||
os.Remove(imageFile)
|
||||
}
|
||||
|
||||
// validateNodeLabels checks if minikube cluster is created with correct kubernetes's node label
|
||||
|
|
@ -293,10 +290,12 @@ func validateLoadImageFromFile(ctx context.Context, t *testing.T, profile string
|
|||
}
|
||||
|
||||
// save image to file
|
||||
imageFile := "busybox-load.tar"
|
||||
rr, err = Run(t, exec.CommandContext(ctx, "docker", "save", "-o", imageFile, taggedImage))
|
||||
if err != nil {
|
||||
t.Fatalf("failed to save image to file: %v\n%s", err, rr.Output())
|
||||
}
|
||||
defer os.Remove(imageFile)
|
||||
|
||||
// try to load the new image into minikube
|
||||
imagePath, err := filepath.Abs(imageFile)
|
||||
|
|
@ -314,7 +313,7 @@ func validateLoadImageFromFile(ctx context.Context, t *testing.T, profile string
|
|||
t.Fatalf("listing images: %v\n%s", err, rr.Output())
|
||||
}
|
||||
if !strings.Contains(rr.Output(), tag) {
|
||||
t.Fatalf("expected %s to be loaded into minikube but the image is not there", taggedImage)
|
||||
t.Fatalf("expected %s to be loaded into minikube but the image is not there: %v", taggedImage, rr.Output())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -432,6 +431,7 @@ func validateSaveImageToFile(ctx context.Context, t *testing.T, profile string)
|
|||
}
|
||||
|
||||
// try to save the new image from minikube
|
||||
imageFile := "busybox-save.tar"
|
||||
imagePath, err := filepath.Abs(imageFile)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to get absolute path of file %q: %v", imageFile, err)
|
||||
|
|
@ -446,6 +446,7 @@ func validateSaveImageToFile(ctx context.Context, t *testing.T, profile string)
|
|||
if err != nil {
|
||||
t.Fatalf("failed to load image to file: %v\n%s", err, rr.Output())
|
||||
}
|
||||
defer os.Remove(imageFile)
|
||||
|
||||
// make sure the image was correctly loaded
|
||||
rr, err = Run(t, exec.CommandContext(ctx, "docker", "images", name))
|
||||
|
|
|
|||
Loading…
Reference in New Issue