Skip to content

Commit a38f96c

Browse files
leodidoona-agent
andcommitted
fix(test): tag loaded Docker image in round-trip test
- docker save stores image with version hash name - docker load restores with original name, not the desired tag - Add docker tag step to apply expected image name - Fixes image inspection failure in round-trip test Co-authored-by: Ona <no-reply@ona.com>
1 parent 7dfb951 commit a38f96c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pkg/leeway/build_integration_test.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,17 @@ CMD ["cat", "/test-file.txt"]`
485485

486486
// Load the image back into Docker
487487
loadCmd := exec.Command("docker", "load", "-i", imageTarPath)
488-
if output, err := loadCmd.CombinedOutput(); err != nil {
489-
t.Fatalf("Failed to load image: %v\nOutput: %s", err, string(output))
488+
loadOutput, err := loadCmd.CombinedOutput()
489+
if err != nil {
490+
t.Fatalf("Failed to load image: %v\nOutput: %s", err, string(loadOutput))
491+
}
492+
t.Logf("Docker load output: %s", string(loadOutput))
493+
494+
// Tag the loaded image with the expected name
495+
// The image is loaded with its build version name, we need to tag it
496+
tagCmd := exec.Command("docker", "tag", metadata.BuiltVersion+":latest", testImage)
497+
if output, err := tagCmd.CombinedOutput(); err != nil {
498+
t.Fatalf("Failed to tag image: %v\nOutput: %s", err, string(output))
490499
}
491500

492501
// Step 5: Verify the loaded image works

0 commit comments

Comments
 (0)