(t *testing.T)
| 38 | } |
| 39 | |
| 40 | func TestContainerRestart(t *testing.T) { |
| 41 | const expectedURL = "/containers/container_id/restart" |
| 42 | client, err := New(WithMockClient(func(req *http.Request) (*http.Response, error) { |
| 43 | if err := assertRequest(req, http.MethodPost, expectedURL); err != nil { |
| 44 | return nil, err |
| 45 | } |
| 46 | s := req.URL.Query().Get("signal") |
| 47 | if s != "SIGKILL" { |
| 48 | return nil, fmt.Errorf("signal not set in URL query. Expected 'SIGKILL', got '%s'", s) |
| 49 | } |
| 50 | t := req.URL.Query().Get("t") |
| 51 | if t != "100" { |
| 52 | return nil, fmt.Errorf("t (timeout) not set in URL query properly. Expected '100', got %s", t) |
| 53 | } |
| 54 | return mockResponse(http.StatusOK, nil, "")(req) |
| 55 | })) |
| 56 | assert.NilError(t, err) |
| 57 | timeout := 100 |
| 58 | _, err = client.ContainerRestart(t.Context(), "container_id", ContainerRestartOptions{ |
| 59 | Signal: "SIGKILL", |
| 60 | Timeout: &timeout, |
| 61 | }) |
| 62 | assert.NilError(t, err) |
| 63 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…