Skip to content

Commit 7c58eb9

Browse files
committed
Remove unnecessary annotations check
Signed-off-by: robert-cronin <[email protected]>
1 parent 2c651e1 commit 7c58eb9

File tree

2 files changed

+11
-31
lines changed

2 files changed

+11
-31
lines changed

integration/multiarch/fixtures/test-images.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"description": "Multi-platform .NET 6.0 runtime, with push",
3737
"ignoreErrors": false,
3838
"push": true,
39+
"skipAnnotations": true,
3940
"platforms": [
4041
"linux/arm/v7",
4142
"linux/arm64"

integration/multiarch/patch_test.go

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ import (
2424
var testImages []byte
2525

2626
type testImage struct {
27-
OriginalImage string `json:"originalImage"`
28-
LocalImage string `json:"localImage"`
29-
Push bool `json:"push"`
30-
Tag string `json:"tag"`
31-
Distro string `json:"distro"`
32-
Description string `json:"description"`
33-
IgnoreErrors bool `json:"ignoreErrors"`
34-
Platforms []string `json:"platforms"`
27+
OriginalImage string `json:"originalImage"`
28+
LocalImage string `json:"localImage"`
29+
Push bool `json:"push"`
30+
Tag string `json:"tag"`
31+
Distro string `json:"distro"`
32+
Description string `json:"description"`
33+
IgnoreErrors bool `json:"ignoreErrors"`
34+
SkipAnnotations bool `json:"skipAnnotations,omitempty"`
35+
Platforms []string `json:"platforms"`
3536
}
3637

3738
func TestPatch(t *testing.T) {
@@ -86,7 +87,7 @@ func TestPatch(t *testing.T) {
8687
t.Log("patching image with multiple architectures")
8788
patchMultiPlatform(t, ref, tagPatched, reportDir, img.IgnoreErrors, img.Push)
8889

89-
if img.Push {
90+
if img.Push && !img.SkipAnnotations {
9091
t.Log("verifying OCI annotations are preserved")
9192
verifyAnnotations(t, patchedRef, img.Platforms, reportDir)
9293
}
@@ -404,28 +405,6 @@ func verifyAnnotations(t *testing.T, patchedRef string, platforms []string, repo
404405
if isPatchablePlatform(platformStr, platforms, reportDir) {
405406
t.Logf("checking manifest annotations for patched platform %s", platformStr)
406407

407-
// Verify that if original nginx annotations exist, they are preserved
408-
commonAnnotations := []string{
409-
"org.opencontainers.image.source",
410-
"org.opencontainers.image.url",
411-
"org.opencontainers.image.version",
412-
"org.opencontainers.image.revision",
413-
"org.opencontainers.image.base.name",
414-
"org.opencontainers.image.base.digest",
415-
}
416-
417-
foundAnnotations := 0
418-
for _, expectedKey := range commonAnnotations {
419-
if value, exists := manifestEntry.Annotations[expectedKey]; exists {
420-
assert.NotEmpty(t, value, "annotation %s should not be empty for platform %s", expectedKey, platformStr)
421-
t.Logf("platform %s has annotation %s=%s", platformStr, expectedKey, value)
422-
foundAnnotations++
423-
}
424-
}
425-
426-
// We expect at least some annotations to be preserved for nginx images
427-
assert.Greater(t, foundAnnotations, 0, "platform %s should have at least some preserved annotations", platformStr)
428-
429408
// The created timestamp should be updated for patched platforms
430409
if createdTime, exists := manifestEntry.Annotations["org.opencontainers.image.created"]; exists {
431410
assert.NotEmpty(t, createdTime, "created timestamp should not be empty for patched platform %s", platformStr)

0 commit comments

Comments
 (0)