MCPcopy
hub / github.com/containerd/containerd / TestNewContainer

Function TestNewContainer

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

Source from the content-addressed store, hash-verified

77}
78
79func TestNewContainer(t *testing.T) {
80 t.Parallel()
81
82 id := t.Name()
83 client, err := newClient(t, address)
84 if err != nil {
85 t.Fatal(err)
86 }
87 defer client.Close()
88
89 ctx, cancel := testContext(t)
90 defer cancel()
91
92 container, err := client.NewContainer(ctx, id, WithNewSpec())
93 if err != nil {
94 t.Fatal(err)
95 }
96 defer container.Delete(ctx)
97 if container.ID() != id {
98 t.Errorf("expected container id %q but received %q", id, container.ID())
99 }
100 if _, err = container.Spec(ctx); err != nil {
101 t.Fatal(err)
102 }
103 if err := container.Delete(ctx); err != nil {
104 t.Fatal(err)
105 }
106}
107
108func TestContainerStart(t *testing.T) {
109 t.Parallel()

Callers

nothing calls this directly

Calls 10

DeleteMethod · 0.95
IDMethod · 0.95
SpecMethod · 0.95
newClientFunction · 0.85
testContextFunction · 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…