MCPcopy
hub / github.com/containerd/containerd / TestContainerNoImage

Function TestContainerNoImage

integration/client/container_test.go:2515–2541  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2513}
2514
2515func TestContainerNoImage(t *testing.T) {
2516 t.Parallel()
2517
2518 ctx, cancel := testContext(t)
2519 defer cancel()
2520 id := t.Name()
2521
2522 client, err := newClient(t, address)
2523 if err != nil {
2524 t.Fatal(err)
2525 }
2526 defer client.Close()
2527
2528 container, err := client.NewContainer(ctx, id, WithNewSpec())
2529 if err != nil {
2530 t.Fatal(err)
2531 }
2532 defer container.Delete(ctx)
2533
2534 _, err = container.Image(ctx)
2535 if err == nil {
2536 t.Fatal("error should not be nil when container is created without an image")
2537 }
2538 if !errdefs.IsNotFound(err) {
2539 t.Fatalf("expected error to be %s but received %s", errdefs.ErrNotFound, err)
2540 }
2541}
2542
2543func TestContainerNoSTDIN(t *testing.T) {
2544 t.Parallel()

Callers

nothing calls this directly

Calls 9

DeleteMethod · 0.95
ImageMethod · 0.95
testContextFunction · 0.85
newClientFunction · 0.85
WithNewSpecFunction · 0.85
FatalMethod · 0.80
NameMethod · 0.65
CloseMethod · 0.65
NewContainerMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…