(t *testing.T)
| 349 | } |
| 350 | |
| 351 | func TestImagePullSomePlatforms(t *testing.T) { |
| 352 | client, err := newClient(t, address) |
| 353 | if err != nil { |
| 354 | t.Fatal(err) |
| 355 | } |
| 356 | defer client.Close() |
| 357 | ctx, cancel := testContext(t) |
| 358 | defer cancel() |
| 359 | |
| 360 | cs := client.ContentStore() |
| 361 | platformList := []string{"linux/amd64", "linux/arm64/v8", "linux/s390x"} |
| 362 | m := make(map[string]platforms.Matcher) |
| 363 | var opts []RemoteOpt |
| 364 | |
| 365 | for _, platform := range platformList { |
| 366 | p, err := platforms.Parse(platform) |
| 367 | if err != nil { |
| 368 | t.Fatal(err) |
| 369 | } |
| 370 | m[platform] = platforms.NewMatcher(p) |
| 371 | opts = append(opts, WithPlatform(platform)) |
| 372 | } |
| 373 | |
| 374 | // Note: Must be different to the image used in TestImagePullAllPlatforms |
| 375 | // or it will see the content pulled by that, and fail. |
| 376 | img, err := client.Fetch(ctx, "registry.k8s.io/e2e-test-images/busybox:1.29-2", opts...) |
| 377 | if err != nil { |
| 378 | t.Fatal(err) |
| 379 | } |
| 380 | |
| 381 | index := img.Target |
| 382 | manifests, err := images.Children(ctx, cs, index) |
| 383 | if err != nil { |
| 384 | t.Fatal(err) |
| 385 | } |
| 386 | |
| 387 | count := 0 |
| 388 | for _, manifest := range manifests { |
| 389 | children, err := images.Children(ctx, cs, manifest) |
| 390 | |
| 391 | found := false |
| 392 | for _, matcher := range m { |
| 393 | if manifest.Platform == nil { |
| 394 | t.Fatal("manifest should have proper platform") |
| 395 | } |
| 396 | if matcher.Match(*manifest.Platform) { |
| 397 | count++ |
| 398 | found = true |
| 399 | } |
| 400 | } |
| 401 | |
| 402 | if found { |
| 403 | if len(children) == 0 { |
| 404 | t.Fatal("manifest should have pulled children content") |
| 405 | } |
| 406 | |
| 407 | // check if childless data type has blob in content store |
| 408 | for _, desc := range children { |
nothing calls this directly
no test coverage detected
searching dependent graphs…