MCPcopy
hub / github.com/containerd/containerd / TestImagePullWithTracing

Function TestImagePullWithTracing

integration/client/client_test.go:450–476  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

448}
449
450func TestImagePullWithTracing(t *testing.T) {
451 client, err := newClient(t, address)
452 require.NoError(t, err)
453 defer client.Close()
454
455 ctx := namespaces.WithNamespace(context.Background(), "tracing")
456
457 //create in memory exporter and global tracer provider for test
458 exp, tp := newInMemoryExporterTracer()
459 //set the tracer provider global available
460 otel.SetTracerProvider(tp)
461 // Shutdown properly so nothing leaks.
462 defer func() { _ = tp.Shutdown(ctx) }()
463
464 //do an image pull which is instrumented, we should expect spans in the exporter
465 _, err = client.Pull(ctx, testImage, WithPlatformMatcher(platforms.Default()))
466 require.NoError(t, err)
467
468 err = tp.ForceFlush(ctx)
469 require.NoError(t, err)
470
471 //The span name was defined in client.pull when instrumented it
472 spanNameExpected := "pull.Pull"
473 spans := exp.GetSpans()
474 validateRootSpan(t, spanNameExpected, spans)
475
476}
477
478func TestImagePullWithConcurrentUnpacks(t *testing.T) {
479 client, err := newClient(t, address)

Callers

nothing calls this directly

Calls 8

WithNamespaceFunction · 0.92
newClientFunction · 0.85
WithPlatformMatcherFunction · 0.85
validateRootSpanFunction · 0.85
CloseMethod · 0.65
ShutdownMethod · 0.65
PullMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…