MCPcopy
hub / github.com/containerd/containerd / assertOCITar

Function assertOCITar

integration/client/export_test.go:348–384  ·  view source on GitHub ↗
(t *testing.T, r io.Reader, docker bool)

Source from the content-addressed store, hash-verified

346}
347
348func assertOCITar(t *testing.T, r io.Reader, docker bool) {
349 t.Helper()
350 // TODO: add more assertion
351 tr := tar.NewReader(r)
352 foundOCILayout := false
353 foundIndexJSON := false
354 foundManifestJSON := false
355 for {
356 h, err := tr.Next()
357 if err == io.EOF {
358 break
359 }
360 if err != nil {
361 t.Fatal(err)
362 }
363 if h.Name == ocispec.ImageLayoutFile {
364 foundOCILayout = true
365 }
366 if h.Name == ocispec.ImageIndexFile {
367 foundIndexJSON = true
368 }
369 if h.Name == "manifest.json" {
370 foundManifestJSON = true
371 }
372 }
373 if !foundOCILayout {
374 t.Error("oci-layout not found")
375 }
376 if !foundIndexJSON {
377 t.Error("index.json not found")
378 }
379 if docker && !foundManifestJSON {
380 t.Error("manifest.json not found")
381 } else if !docker && foundManifestJSON {
382 t.Error("manifest.json found")
383 }
384}
385
386func assertOCIIndexAnnotationRefName(t *testing.T, r io.Reader) {
387

Callers 1

TestExportAllCasesFunction · 0.85

Calls 2

FatalMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…