MCPcopy
hub / github.com/moby/moby / TestCreateFailsWhenIdentifierDoesNotExist

Function TestCreateFailsWhenIdentifierDoesNotExist

integration/container/create_test.go:32–71  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30)
31
32func TestCreateFailsWhenIdentifierDoesNotExist(t *testing.T) {
33 ctx := setupTest(t)
34 apiClient := testEnv.APIClient()
35
36 testCases := []struct {
37 doc string
38 image string
39 expectedError string
40 }{
41 {
42 doc: "image and tag",
43 image: "test456:v1",
44 expectedError: "No such image: test456:v1",
45 },
46 {
47 doc: "image no tag",
48 image: "test456",
49 expectedError: "No such image: test456",
50 },
51 {
52 doc: "digest",
53 image: "sha256:0cb40641836c461bc97c793971d84d758371ed682042457523e4ae701efeaaaa",
54 expectedError: "No such image: sha256:0cb40641836c461bc97c793971d84d758371ed682042457523e4ae701efeaaaa",
55 },
56 }
57
58 for _, tc := range testCases {
59 t.Run(tc.doc, func(t *testing.T) {
60 t.Parallel()
61 ctx := testutil.StartSpan(ctx, t)
62 _, err := apiClient.ContainerCreate(ctx, client.ContainerCreateOptions{
63 Config: &container.Config{Image: tc.image},
64 HostConfig: &container.HostConfig{},
65 NetworkingConfig: &network.NetworkingConfig{},
66 })
67 assert.Check(t, is.ErrorContains(err, tc.expectedError))
68 assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
69 })
70 }
71}
72
73func TestCreateByImageID(t *testing.T) {
74 ctx := setupTest(t)

Callers

nothing calls this directly

Calls 6

StartSpanFunction · 0.92
APIClientMethod · 0.80
CheckMethod · 0.80
setupTestFunction · 0.70
RunMethod · 0.65
ContainerCreateMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…