summaryrefslogtreecommitdiffstats
path: root/tests/integration/api_packages_container_test.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2023-04-02 11:53:37 +0200
committerGitHub <noreply@github.com>2023-04-02 11:53:37 +0200
commitfbd4eaceed801e7400ed04a9dadedaf3a25dccb9 (patch)
tree9c25636fbfa755702b77f781147a096e5eafd309 /tests/integration/api_packages_container_test.go
parentUse clippie module to copy to clipboard (#23801) (diff)
downloadforgejo-fbd4eaceed801e7400ed04a9dadedaf3a25dccb9.tar.xz
forgejo-fbd4eaceed801e7400ed04a9dadedaf3a25dccb9.zip
Display image size for multiarch container images (#23821)
Fixes #23771 Changes the display of different architectures for multiarch images to show the image size: ![grafik](https://user-images.githubusercontent.com/1666336/228781477-cc76c4d1-4728-434f-8a27-fc008790d924.png)
Diffstat (limited to 'tests/integration/api_packages_container_test.go')
-rw-r--r--tests/integration/api_packages_container_test.go22
1 files changed, 17 insertions, 5 deletions
diff --git a/tests/integration/api_packages_container_test.go b/tests/integration/api_packages_container_test.go
index d925fd1647..fe9208bb05 100644
--- a/tests/integration/api_packages_container_test.go
+++ b/tests/integration/api_packages_container_test.go
@@ -321,7 +321,7 @@ func TestPackageContainer(t *testing.T) {
metadata := pd.Metadata.(*container_module.Metadata)
assert.Equal(t, container_module.TypeOCI, metadata.Type)
assert.Len(t, metadata.ImageLayers, 2)
- assert.Empty(t, metadata.MultiArch)
+ assert.Empty(t, metadata.Manifests)
assert.Len(t, pd.Files, 3)
for _, pfd := range pd.Files {
@@ -462,10 +462,22 @@ func TestPackageContainer(t *testing.T) {
assert.IsType(t, &container_module.Metadata{}, pd.Metadata)
metadata := pd.Metadata.(*container_module.Metadata)
assert.Equal(t, container_module.TypeOCI, metadata.Type)
- assert.Contains(t, metadata.MultiArch, "linux/arm/v7")
- assert.Equal(t, manifestDigest, metadata.MultiArch["linux/arm/v7"])
- assert.Contains(t, metadata.MultiArch, "linux/arm64/v8")
- assert.Equal(t, untaggedManifestDigest, metadata.MultiArch["linux/arm64/v8"])
+ assert.Len(t, metadata.Manifests, 2)
+ assert.Condition(t, func() bool {
+ for _, m := range metadata.Manifests {
+ switch m.Platform {
+ case "linux/arm/v7":
+ assert.Equal(t, manifestDigest, m.Digest)
+ assert.EqualValues(t, 1524, m.Size)
+ case "linux/arm64/v8":
+ assert.Equal(t, untaggedManifestDigest, m.Digest)
+ assert.EqualValues(t, 1514, m.Size)
+ default:
+ return false
+ }
+ }
+ return true
+ })
assert.Len(t, pd.Files, 1)
assert.True(t, pd.Files[0].File.IsLead)