MCPcopy
hub / github.com/moby/moby / TestContainerWait

Function TestContainerWait

client/container_wait_test.go:54–76  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

52}
53
54func TestContainerWait(t *testing.T) {
55 ctx, cancel := context.WithCancel(t.Context())
56 defer cancel()
57
58 const expectedURL = "/containers/container_id/wait"
59 client, err := New(WithMockClient(func(req *http.Request) (*http.Response, error) {
60 if err := assertRequest(req, http.MethodPost, expectedURL); err != nil {
61 return nil, err
62 }
63 return mockJSONResponse(http.StatusOK, nil, container.WaitResponse{
64 StatusCode: 15,
65 })(req)
66 }))
67 assert.NilError(t, err)
68
69 wait := client.ContainerWait(ctx, "container_id", ContainerWaitOptions{})
70 select {
71 case err := <-wait.Error:
72 assert.NilError(t, err)
73 case result := <-wait.Result:
74 assert.Check(t, is.Equal(result.StatusCode, int64(15)))
75 }
76}
77
78func TestContainerWaitProxyInterrupt(t *testing.T) {
79 ctx, cancel := context.WithCancel(t.Context())

Callers

nothing calls this directly

Calls 8

WithMockClientFunction · 0.85
assertRequestFunction · 0.85
mockJSONResponseFunction · 0.85
CheckMethod · 0.80
EqualMethod · 0.80
NewFunction · 0.70
ContextMethod · 0.65
ContainerWaitMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…