(t *testing.T, r io.Reader, docker bool)
| 346 | } |
| 347 | |
| 348 | func 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 | |
| 386 | func assertOCIIndexAnnotationRefName(t *testing.T, r io.Reader) { |
| 387 |
no test coverage detected
searching dependent graphs…