Skip to content

Commit

Permalink
Fix airgap test to not rely on overwriting bundles
Browse files Browse the repository at this point in the history
Signed-off-by: Carolyn Van Slyck <[email protected]>
  • Loading branch information
carolynvs committed Sep 3, 2022
1 parent 8c74bec commit 6832d59
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/smoke/airgap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ func TestAirgappedEnvironment(t *testing.T) {
// 1. Copy the bundle from one registry to the other directly
//
origRef := fmt.Sprintf("%s/%s:%s", reg2, testdata.MyBuns, "v0.1.2")
newRef := fmt.Sprintf("%s/%s-second:%s", reg2, testdata.MyBuns, "v0.2.0")
test.RequirePorter("copy", "--source", origRef, "--destination", newRef, insecureFlag)
copyRef := fmt.Sprintf("%s/%s-copy:v0.2.0", reg2, testdata.MyBuns)
test.RequirePorter("copy", "--source", origRef, "--destination", copyRef, insecureFlag)

//
// 2. Use archive + publish to copy the bundle from one registry to the other
Expand All @@ -103,20 +103,21 @@ func TestAirgappedEnvironment(t *testing.T) {
require.Equal(test.T, fmt.Sprintf("%s/mybuns@sha256:499f71eec2e3bd78f26c268bbf5b2a65f73b96216fac4a89b86b5ebf115527b6", reg2), relocMap[localRefWithDigest], "expected the relocation entry for the image to be the new published location")

// Publish from the archived bundle to a new repository on the second registry
test.RequirePorter("publish", "--archive", archiveFilePath, "-r", newRef, insecureFlag)
airgapRef := fmt.Sprintf("%s/%s-publish:v0.2.0", reg2, testdata.MyBuns)
test.RequirePorter("publish", "--archive", archiveFilePath, "-r", airgapRef, insecureFlag)
archiveFilePath2 := filepath.Join(test.TestDir, "archive-test2.tgz")

// Archive from the new location on the second registry
test.RequirePorter("archive", archiveFilePath2, "--reference", newRef, insecureFlag)
test.RequirePorter("archive", archiveFilePath2, "--reference", airgapRef, insecureFlag)
relocMap2 := getRelocationMap(test, archiveFilePath2)
require.Equal(test.T, fmt.Sprintf("%s/mybuns-second@sha256:499f71eec2e3bd78f26c268bbf5b2a65f73b96216fac4a89b86b5ebf115527b6", reg2), relocMap2[localRefWithDigest], "expected the relocation entry for the image to be the new published location")
require.Equal(test.T, fmt.Sprintf("%s/mybuns-publish@sha256:499f71eec2e3bd78f26c268bbf5b2a65f73b96216fac4a89b86b5ebf115527b6", reg2), relocMap2[localRefWithDigest], "expected the relocation entry for the image to be the new published location")

// Validate that we can pull the bundle from the new location
test.RequirePorter("explain", newRef)
test.RequirePorter("explain", airgapRef)

// Validate that we can install from the new location
test.ApplyTestBundlePrerequisites()
test.RequirePorter("install", "-r", newRef, insecureFlag, "-c=mybuns", "-p=mybuns")
test.RequirePorter("install", "-r", airgapRef, insecureFlag, "-c=mybuns", "-p=mybuns")
})
}
}
Expand Down

0 comments on commit 6832d59

Please sign in to comment.