(t *testing.T)
| 350 | } |
| 351 | |
| 352 | func TestCreateContainerWithNotifyChannel(t *testing.T) { |
| 353 | t.Parallel() |
| 354 | ch := make(chan *docker.Container, 1) |
| 355 | server := baseDockerServer() |
| 356 | server.imgIDs = map[string]string{"base": "a1234"} |
| 357 | server.cChan = ch |
| 358 | server.buildMuxer() |
| 359 | recorder := httptest.NewRecorder() |
| 360 | body := `{"Hostname":"", "User":"", "Memory":0, "MemorySwap":0, "AttachStdin":false, "AttachStdout":true, "AttachStderr":true, |
| 361 | "PortSpecs":null, "Tty":false, "OpenStdin":false, "StdinOnce":false, "Env":null, "Cmd":["date"], "Image":"base", "Volumes":{}, "VolumesFrom":""}` |
| 362 | request, _ := http.NewRequest(http.MethodPost, "/containers/create", strings.NewReader(body)) |
| 363 | server.ServeHTTP(recorder, request) |
| 364 | if recorder.Code != http.StatusCreated { |
| 365 | t.Errorf("CreateContainer: wrong status. Want %d. Got %d.", http.StatusCreated, recorder.Code) |
| 366 | } |
| 367 | if notified := <-ch; notified != getContainer(&server) { |
| 368 | t.Errorf("CreateContainer: did not notify the proper container. Want %q. Got %q.", getContainer(&server).ID, notified.ID) |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | func TestCreateContainerInvalidBody(t *testing.T) { |
| 373 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…