@@ -110,6 +110,23 @@ var (
110110 "mediaType": "application/vnd.oci.image.manifest.v1+json",
111111 "schemaVersion": 2
112112}
113+ `
114+ manifestlistStr = `{
115+ "schemaVersion": 2,
116+ "mediaType": "application/vnd.oci.image.manifest.list.v1+json",
117+ "manifests": [
118+ {
119+ "mediaType": "application/vnd.oci.image.manifest.v1+json",
120+ "size": "<manifest_size>",
121+ "digest": "<manifest_digest>",
122+ "platform": {
123+ "architecture": "ppc64le",
124+ "os": "linux"
125+ }
126+ }
127+ ],
128+ "annotations": null
129+ }
113130 `
114131)
115132
@@ -119,12 +136,13 @@ type tarContent struct {
119136}
120137
121138type imageLayout struct {
122- rootDir string
123- layout string
124- ref string
125- manifest string
126- config string
127- tarList []tarContent
139+ rootDir string
140+ layout string
141+ ref string
142+ manifest string
143+ manifestlist string
144+ config string
145+ tarList []tarContent
128146}
129147
130148func TestValidateLayout (t * testing.T ) {
@@ -135,11 +153,12 @@ func TestValidateLayout(t *testing.T) {
135153 defer os .RemoveAll (root )
136154
137155 il := imageLayout {
138- rootDir : root ,
139- layout : layoutStr ,
140- ref : refTag ,
141- manifest : manifestStr ,
142- config : configStr ,
156+ rootDir : root ,
157+ layout : layoutStr ,
158+ ref : refTag ,
159+ manifest : manifestStr ,
160+ manifestlist : manifestlistStr ,
161+ config : configStr ,
143162 tarList : []tarContent {
144163 tarContent {& tar.Header {Name : "test" , Size : 4 , Mode : 0600 }, []byte ("test" )},
145164 },
@@ -195,6 +214,12 @@ func createImageLayoutBundle(il imageLayout) error {
195214 return err
196215 }
197216
217+ // create manifestlist blob file
218+ desc , err = createManifestListFile (il .rootDir , il .manifestlist )
219+ if err != nil {
220+ return err
221+ }
222+
198223 return createRefFile (il .rootDir , il .ref , desc )
199224}
200225
@@ -238,6 +263,23 @@ func createManifestFile(root, str string) (descriptor, error) {
238263 return createHashedBlob (name )
239264}
240265
266+
267+ func createManifestListFile (root , str string ) (descriptor , error ) {
268+ name := filepath .Join (root , "blobs" , "sha256" , "test-manifestlist" )
269+ f , err := os .Create (name )
270+ if err != nil {
271+ return descriptor {}, err
272+ }
273+ defer f .Close ()
274+
275+ _ , err = io .Copy (f , bytes .NewBuffer ([]byte (str )))
276+ if err != nil {
277+ return descriptor {}, err
278+ }
279+
280+ return createHashedBlob (name )
281+ }
282+
241283func createConfigFile (root , config string ) (descriptor , error ) {
242284 name := filepath .Join (root , "blobs" , "sha256" , "test-config" )
243285 f , err := os .Create (name )
0 commit comments