|
@@ -37,17 +37,17 @@ func TestGetAuth(t *testing.T) {
|
|
|
Email: "utest@yopmail.com",
|
|
|
}
|
|
|
|
|
|
- authConfigJson, err := json.Marshal(authConfig)
|
|
|
+ authConfigJSON, err := json.Marshal(authConfig)
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- req, err := http.NewRequest("POST", "/auth", bytes.NewReader(authConfigJson))
|
|
|
+ req, err := http.NewRequest("POST", "/auth", bytes.NewReader(authConfigJSON))
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- if err := postAuth(srv, API_VERSION, r, req, nil); err != nil {
|
|
|
+ if err := postAuth(srv, APIVERSION, r, req, nil); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
@@ -73,11 +73,11 @@ func TestGetVersion(t *testing.T) {
|
|
|
|
|
|
r := httptest.NewRecorder()
|
|
|
|
|
|
- if err := getVersion(srv, API_VERSION, r, nil, nil); err != nil {
|
|
|
+ if err := getVersion(srv, APIVERSION, r, nil, nil); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- v := &ApiVersion{}
|
|
|
+ v := &APIVersion{}
|
|
|
if err = json.Unmarshal(r.Body.Bytes(), v); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
@@ -97,11 +97,11 @@ func TestGetInfo(t *testing.T) {
|
|
|
|
|
|
r := httptest.NewRecorder()
|
|
|
|
|
|
- if err := getInfo(srv, API_VERSION, r, nil, nil); err != nil {
|
|
|
+ if err := getInfo(srv, APIVERSION, r, nil, nil); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- infos := &ApiInfo{}
|
|
|
+ infos := &APIInfo{}
|
|
|
err = json.Unmarshal(r.Body.Bytes(), infos)
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
@@ -111,7 +111,7 @@ func TestGetInfo(t *testing.T) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func TestGetImagesJson(t *testing.T) {
|
|
|
+func TestGetImagesJSON(t *testing.T) {
|
|
|
runtime, err := newTestRuntime()
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
@@ -128,11 +128,11 @@ func TestGetImagesJson(t *testing.T) {
|
|
|
|
|
|
r := httptest.NewRecorder()
|
|
|
|
|
|
- if err := getImagesJson(srv, API_VERSION, r, req, nil); err != nil {
|
|
|
+ if err := getImagesJSON(srv, APIVERSION, r, req, nil); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- images := []ApiImages{}
|
|
|
+ images := []APIImages{}
|
|
|
if err := json.Unmarshal(r.Body.Bytes(), &images); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
@@ -153,11 +153,11 @@ func TestGetImagesJson(t *testing.T) {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- if err := getImagesJson(srv, API_VERSION, r2, req2, nil); err != nil {
|
|
|
+ if err := getImagesJSON(srv, APIVERSION, r2, req2, nil); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- images2 := []ApiImages{}
|
|
|
+ images2 := []APIImages{}
|
|
|
if err := json.Unmarshal(r2.Body.Bytes(), &images2); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
@@ -166,8 +166,8 @@ func TestGetImagesJson(t *testing.T) {
|
|
|
t.Errorf("Excepted 1 image, %d found", len(images2))
|
|
|
}
|
|
|
|
|
|
- if images2[0].Id != GetTestImage(runtime).Id {
|
|
|
- t.Errorf("Retrieved image Id differs, expected %s, received %s", GetTestImage(runtime).Id, images2[0].Id)
|
|
|
+ if images2[0].ID != GetTestImage(runtime).ID {
|
|
|
+ t.Errorf("Retrieved image Id differs, expected %s, received %s", GetTestImage(runtime).ID, images2[0].ID)
|
|
|
}
|
|
|
|
|
|
r3 := httptest.NewRecorder()
|
|
@@ -178,11 +178,11 @@ func TestGetImagesJson(t *testing.T) {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- if err := getImagesJson(srv, API_VERSION, r3, req3, nil); err != nil {
|
|
|
+ if err := getImagesJSON(srv, APIVERSION, r3, req3, nil); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- images3 := []ApiImages{}
|
|
|
+ images3 := []APIImages{}
|
|
|
if err := json.Unmarshal(r3.Body.Bytes(), &images3); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
@@ -199,7 +199,7 @@ func TestGetImagesJson(t *testing.T) {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- err = getImagesJson(srv, API_VERSION, r4, req4, nil)
|
|
|
+ err = getImagesJSON(srv, APIVERSION, r4, req4, nil)
|
|
|
if err == nil {
|
|
|
t.Fatalf("Error expected, received none")
|
|
|
}
|
|
@@ -220,7 +220,7 @@ func TestGetImagesViz(t *testing.T) {
|
|
|
srv := &Server{runtime: runtime}
|
|
|
|
|
|
r := httptest.NewRecorder()
|
|
|
- if err := getImagesViz(srv, API_VERSION, r, nil, nil); err != nil {
|
|
|
+ if err := getImagesViz(srv, APIVERSION, r, nil, nil); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
@@ -256,11 +256,11 @@ func TestGetImagesSearch(t *testing.T) {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- if err := getImagesSearch(srv, API_VERSION, r, req, nil); err != nil {
|
|
|
+ if err := getImagesSearch(srv, APIVERSION, r, req, nil); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- results := []ApiSearch{}
|
|
|
+ results := []APISearch{}
|
|
|
if err := json.Unmarshal(r.Body.Bytes(), &results); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
@@ -280,11 +280,11 @@ func TestGetImagesHistory(t *testing.T) {
|
|
|
|
|
|
r := httptest.NewRecorder()
|
|
|
|
|
|
- if err := getImagesHistory(srv, API_VERSION, r, nil, map[string]string{"name": unitTestImageName}); err != nil {
|
|
|
+ if err := getImagesHistory(srv, APIVERSION, r, nil, map[string]string{"name": unitTestImageName}); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- history := []ApiHistory{}
|
|
|
+ history := []APIHistory{}
|
|
|
if err := json.Unmarshal(r.Body.Bytes(), &history); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
@@ -303,7 +303,7 @@ func TestGetImagesByName(t *testing.T) {
|
|
|
srv := &Server{runtime: runtime}
|
|
|
|
|
|
r := httptest.NewRecorder()
|
|
|
- if err := getImagesByName(srv, API_VERSION, r, nil, map[string]string{"name": unitTestImageName}); err != nil {
|
|
|
+ if err := getImagesByName(srv, APIVERSION, r, nil, map[string]string{"name": unitTestImageName}); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
@@ -311,12 +311,12 @@ func TestGetImagesByName(t *testing.T) {
|
|
|
if err := json.Unmarshal(r.Body.Bytes(), img); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
- if img.Id != GetTestImage(runtime).Id || img.Comment != "Imported from http://get.docker.io/images/busybox" {
|
|
|
+ if img.ID != GetTestImage(runtime).ID || img.Comment != "Imported from http://get.docker.io/images/busybox" {
|
|
|
t.Errorf("Error inspecting image")
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func TestGetContainersJson(t *testing.T) {
|
|
|
+func TestGetContainersJSON(t *testing.T) {
|
|
|
runtime, err := newTestRuntime()
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
@@ -326,7 +326,7 @@ func TestGetContainersJson(t *testing.T) {
|
|
|
srv := &Server{runtime: runtime}
|
|
|
|
|
|
container, err := NewBuilder(runtime).Create(&Config{
|
|
|
- Image: GetTestImage(runtime).Id,
|
|
|
+ Image: GetTestImage(runtime).ID,
|
|
|
Cmd: []string{"echo", "test"},
|
|
|
})
|
|
|
if err != nil {
|
|
@@ -340,18 +340,18 @@ func TestGetContainersJson(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
r := httptest.NewRecorder()
|
|
|
- if err := getContainersJson(srv, API_VERSION, r, req, nil); err != nil {
|
|
|
+ if err := getContainersJSON(srv, APIVERSION, r, req, nil); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
- containers := []ApiContainers{}
|
|
|
+ containers := []APIContainers{}
|
|
|
if err := json.Unmarshal(r.Body.Bytes(), &containers); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
if len(containers) != 1 {
|
|
|
t.Fatalf("Excepted %d container, %d found", 1, len(containers))
|
|
|
}
|
|
|
- if containers[0].Id != container.Id {
|
|
|
- t.Fatalf("Container ID mismatch. Expected: %s, received: %s\n", container.Id, containers[0].Id)
|
|
|
+ if containers[0].ID != container.ID {
|
|
|
+ t.Fatalf("Container ID mismatch. Expected: %s, received: %s\n", container.ID, containers[0].ID)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -369,7 +369,7 @@ func TestGetContainersExport(t *testing.T) {
|
|
|
// Create a container and remove a file
|
|
|
container, err := builder.Create(
|
|
|
&Config{
|
|
|
- Image: GetTestImage(runtime).Id,
|
|
|
+ Image: GetTestImage(runtime).ID,
|
|
|
Cmd: []string{"touch", "/test"},
|
|
|
},
|
|
|
)
|
|
@@ -383,7 +383,7 @@ func TestGetContainersExport(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
r := httptest.NewRecorder()
|
|
|
- if err = getContainersExport(srv, API_VERSION, r, nil, map[string]string{"name": container.Id}); err != nil {
|
|
|
+ if err = getContainersExport(srv, APIVERSION, r, nil, map[string]string{"name": container.ID}); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
@@ -424,7 +424,7 @@ func TestGetContainersChanges(t *testing.T) {
|
|
|
// Create a container and remove a file
|
|
|
container, err := builder.Create(
|
|
|
&Config{
|
|
|
- Image: GetTestImage(runtime).Id,
|
|
|
+ Image: GetTestImage(runtime).ID,
|
|
|
Cmd: []string{"/bin/rm", "/etc/passwd"},
|
|
|
},
|
|
|
)
|
|
@@ -438,7 +438,7 @@ func TestGetContainersChanges(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
r := httptest.NewRecorder()
|
|
|
- if err := getContainersChanges(srv, API_VERSION, r, nil, map[string]string{"name": container.Id}); err != nil {
|
|
|
+ if err := getContainersChanges(srv, APIVERSION, r, nil, map[string]string{"name": container.ID}); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
changes := []Change{}
|
|
@@ -472,7 +472,7 @@ func TestGetContainersByName(t *testing.T) {
|
|
|
// Create a container and remove a file
|
|
|
container, err := builder.Create(
|
|
|
&Config{
|
|
|
- Image: GetTestImage(runtime).Id,
|
|
|
+ Image: GetTestImage(runtime).ID,
|
|
|
Cmd: []string{"echo", "test"},
|
|
|
},
|
|
|
)
|
|
@@ -482,15 +482,15 @@ func TestGetContainersByName(t *testing.T) {
|
|
|
defer runtime.Destroy(container)
|
|
|
|
|
|
r := httptest.NewRecorder()
|
|
|
- if err := getContainersByName(srv, API_VERSION, r, nil, map[string]string{"name": container.Id}); err != nil {
|
|
|
+ if err := getContainersByName(srv, APIVERSION, r, nil, map[string]string{"name": container.ID}); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
outContainer := &Container{}
|
|
|
if err := json.Unmarshal(r.Body.Bytes(), outContainer); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
- if outContainer.Id != container.Id {
|
|
|
- t.Fatalf("Wrong containers retrieved. Expected %s, recieved %s", container.Id, outContainer.Id)
|
|
|
+ if outContainer.ID != container.ID {
|
|
|
+ t.Fatalf("Wrong containers retrieved. Expected %s, recieved %s", container.ID, outContainer.ID)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -514,7 +514,7 @@ func TestPostAuth(t *testing.T) {
|
|
|
auth.SaveConfig(runtime.root, authStr, config.Email)
|
|
|
|
|
|
r := httptest.NewRecorder()
|
|
|
- if err := getAuth(srv, API_VERSION, r, nil, nil); err != nil {
|
|
|
+ if err := getAuth(srv, APIVERSION, r, nil, nil); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
@@ -542,7 +542,7 @@ func TestPostCommit(t *testing.T) {
|
|
|
// Create a container and remove a file
|
|
|
container, err := builder.Create(
|
|
|
&Config{
|
|
|
- Image: GetTestImage(runtime).Id,
|
|
|
+ Image: GetTestImage(runtime).ID,
|
|
|
Cmd: []string{"touch", "/test"},
|
|
|
},
|
|
|
)
|
|
@@ -555,24 +555,24 @@ func TestPostCommit(t *testing.T) {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- req, err := http.NewRequest("POST", "/commit?repo=testrepo&testtag=tag&container="+container.Id, bytes.NewReader([]byte{}))
|
|
|
+ req, err := http.NewRequest("POST", "/commit?repo=testrepo&testtag=tag&container="+container.ID, bytes.NewReader([]byte{}))
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
r := httptest.NewRecorder()
|
|
|
- if err := postCommit(srv, API_VERSION, r, req, nil); err != nil {
|
|
|
+ if err := postCommit(srv, APIVERSION, r, req, nil); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
if r.Code != http.StatusCreated {
|
|
|
t.Fatalf("%d Created expected, received %d\n", http.StatusCreated, r.Code)
|
|
|
}
|
|
|
|
|
|
- apiId := &ApiId{}
|
|
|
- if err := json.Unmarshal(r.Body.Bytes(), apiId); err != nil {
|
|
|
+ apiID := &APIID{}
|
|
|
+ if err := json.Unmarshal(r.Body.Bytes(), apiID); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
- if _, err := runtime.graph.Get(apiId.Id); err != nil {
|
|
|
+ if _, err := runtime.graph.Get(apiID.ID); err != nil {
|
|
|
t.Fatalf("The image has not been commited")
|
|
|
}
|
|
|
}
|
|
@@ -715,7 +715,7 @@ func TestPostImagesInsert(t *testing.T) {
|
|
|
// t.Fatalf("The test file has not been found")
|
|
|
// }
|
|
|
|
|
|
- // if err := srv.runtime.graph.Delete(img.Id); err != nil {
|
|
|
+ // if err := srv.runtime.graph.Delete(img.ID); err != nil {
|
|
|
// t.Fatal(err)
|
|
|
// }
|
|
|
}
|
|
@@ -824,8 +824,8 @@ func TestPostContainersCreate(t *testing.T) {
|
|
|
|
|
|
srv := &Server{runtime: runtime}
|
|
|
|
|
|
- configJson, err := json.Marshal(&Config{
|
|
|
- Image: GetTestImage(runtime).Id,
|
|
|
+ configJSON, err := json.Marshal(&Config{
|
|
|
+ Image: GetTestImage(runtime).ID,
|
|
|
Memory: 33554432,
|
|
|
Cmd: []string{"touch", "/test"},
|
|
|
})
|
|
@@ -833,25 +833,25 @@ func TestPostContainersCreate(t *testing.T) {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- req, err := http.NewRequest("POST", "/containers/create", bytes.NewReader(configJson))
|
|
|
+ req, err := http.NewRequest("POST", "/containers/create", bytes.NewReader(configJSON))
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
r := httptest.NewRecorder()
|
|
|
- if err := postContainersCreate(srv, API_VERSION, r, req, nil); err != nil {
|
|
|
+ if err := postContainersCreate(srv, APIVERSION, r, req, nil); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
if r.Code != http.StatusCreated {
|
|
|
t.Fatalf("%d Created expected, received %d\n", http.StatusCreated, r.Code)
|
|
|
}
|
|
|
|
|
|
- apiRun := &ApiRun{}
|
|
|
+ apiRun := &APIRun{}
|
|
|
if err := json.Unmarshal(r.Body.Bytes(), apiRun); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- container := srv.runtime.Get(apiRun.Id)
|
|
|
+ container := srv.runtime.Get(apiRun.ID)
|
|
|
if container == nil {
|
|
|
t.Fatalf("Container not created")
|
|
|
}
|
|
@@ -880,7 +880,7 @@ func TestPostContainersKill(t *testing.T) {
|
|
|
|
|
|
container, err := NewBuilder(runtime).Create(
|
|
|
&Config{
|
|
|
- Image: GetTestImage(runtime).Id,
|
|
|
+ Image: GetTestImage(runtime).ID,
|
|
|
Cmd: []string{"/bin/cat"},
|
|
|
OpenStdin: true,
|
|
|
},
|
|
@@ -902,7 +902,7 @@ func TestPostContainersKill(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
r := httptest.NewRecorder()
|
|
|
- if err := postContainersKill(srv, API_VERSION, r, nil, map[string]string{"name": container.Id}); err != nil {
|
|
|
+ if err := postContainersKill(srv, APIVERSION, r, nil, map[string]string{"name": container.ID}); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
if r.Code != http.StatusNoContent {
|
|
@@ -924,7 +924,7 @@ func TestPostContainersRestart(t *testing.T) {
|
|
|
|
|
|
container, err := NewBuilder(runtime).Create(
|
|
|
&Config{
|
|
|
- Image: GetTestImage(runtime).Id,
|
|
|
+ Image: GetTestImage(runtime).ID,
|
|
|
Cmd: []string{"/bin/cat"},
|
|
|
OpenStdin: true,
|
|
|
},
|
|
@@ -945,12 +945,12 @@ func TestPostContainersRestart(t *testing.T) {
|
|
|
t.Errorf("Container should be running")
|
|
|
}
|
|
|
|
|
|
- req, err := http.NewRequest("POST", "/containers/"+container.Id+"/restart?t=1", bytes.NewReader([]byte{}))
|
|
|
+ req, err := http.NewRequest("POST", "/containers/"+container.ID+"/restart?t=1", bytes.NewReader([]byte{}))
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
r := httptest.NewRecorder()
|
|
|
- if err := postContainersRestart(srv, API_VERSION, r, req, map[string]string{"name": container.Id}); err != nil {
|
|
|
+ if err := postContainersRestart(srv, APIVERSION, r, req, map[string]string{"name": container.ID}); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
if r.Code != http.StatusNoContent {
|
|
@@ -980,7 +980,7 @@ func TestPostContainersStart(t *testing.T) {
|
|
|
|
|
|
container, err := NewBuilder(runtime).Create(
|
|
|
&Config{
|
|
|
- Image: GetTestImage(runtime).Id,
|
|
|
+ Image: GetTestImage(runtime).ID,
|
|
|
Cmd: []string{"/bin/cat"},
|
|
|
OpenStdin: true,
|
|
|
},
|
|
@@ -991,7 +991,7 @@ func TestPostContainersStart(t *testing.T) {
|
|
|
defer runtime.Destroy(container)
|
|
|
|
|
|
r := httptest.NewRecorder()
|
|
|
- if err := postContainersStart(srv, API_VERSION, r, nil, map[string]string{"name": container.Id}); err != nil {
|
|
|
+ if err := postContainersStart(srv, APIVERSION, r, nil, map[string]string{"name": container.ID}); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
if r.Code != http.StatusNoContent {
|
|
@@ -1006,7 +1006,7 @@ func TestPostContainersStart(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
r = httptest.NewRecorder()
|
|
|
- if err = postContainersStart(srv, API_VERSION, r, nil, map[string]string{"name": container.Id}); err == nil {
|
|
|
+ if err = postContainersStart(srv, APIVERSION, r, nil, map[string]string{"name": container.ID}); err == nil {
|
|
|
t.Fatalf("A running containter should be able to be started")
|
|
|
}
|
|
|
|
|
@@ -1026,7 +1026,7 @@ func TestPostContainersStop(t *testing.T) {
|
|
|
|
|
|
container, err := NewBuilder(runtime).Create(
|
|
|
&Config{
|
|
|
- Image: GetTestImage(runtime).Id,
|
|
|
+ Image: GetTestImage(runtime).ID,
|
|
|
Cmd: []string{"/bin/cat"},
|
|
|
OpenStdin: true,
|
|
|
},
|
|
@@ -1048,12 +1048,12 @@ func TestPostContainersStop(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
// Note: as it is a POST request, it requires a body.
|
|
|
- req, err := http.NewRequest("POST", "/containers/"+container.Id+"/stop?t=1", bytes.NewReader([]byte{}))
|
|
|
+ req, err := http.NewRequest("POST", "/containers/"+container.ID+"/stop?t=1", bytes.NewReader([]byte{}))
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
r := httptest.NewRecorder()
|
|
|
- if err := postContainersStop(srv, API_VERSION, r, req, map[string]string{"name": container.Id}); err != nil {
|
|
|
+ if err := postContainersStop(srv, APIVERSION, r, req, map[string]string{"name": container.ID}); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
if r.Code != http.StatusNoContent {
|
|
@@ -1075,7 +1075,7 @@ func TestPostContainersWait(t *testing.T) {
|
|
|
|
|
|
container, err := NewBuilder(runtime).Create(
|
|
|
&Config{
|
|
|
- Image: GetTestImage(runtime).Id,
|
|
|
+ Image: GetTestImage(runtime).ID,
|
|
|
Cmd: []string{"/bin/sleep", "1"},
|
|
|
OpenStdin: true,
|
|
|
},
|
|
@@ -1091,10 +1091,10 @@ func TestPostContainersWait(t *testing.T) {
|
|
|
|
|
|
setTimeout(t, "Wait timed out", 3*time.Second, func() {
|
|
|
r := httptest.NewRecorder()
|
|
|
- if err := postContainersWait(srv, API_VERSION, r, nil, map[string]string{"name": container.Id}); err != nil {
|
|
|
+ if err := postContainersWait(srv, APIVERSION, r, nil, map[string]string{"name": container.ID}); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
- apiWait := &ApiWait{}
|
|
|
+ apiWait := &APIWait{}
|
|
|
if err := json.Unmarshal(r.Body.Bytes(), apiWait); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
@@ -1119,7 +1119,7 @@ func TestPostContainersAttach(t *testing.T) {
|
|
|
|
|
|
container, err := NewBuilder(runtime).Create(
|
|
|
&Config{
|
|
|
- Image: GetTestImage(runtime).Id,
|
|
|
+ Image: GetTestImage(runtime).ID,
|
|
|
Cmd: []string{"/bin/cat"},
|
|
|
OpenStdin: true,
|
|
|
},
|
|
@@ -1148,12 +1148,12 @@ func TestPostContainersAttach(t *testing.T) {
|
|
|
out: stdoutPipe,
|
|
|
}
|
|
|
|
|
|
- req, err := http.NewRequest("POST", "/containers/"+container.Id+"/attach?stream=1&stdin=1&stdout=1&stderr=1", bytes.NewReader([]byte{}))
|
|
|
+ req, err := http.NewRequest("POST", "/containers/"+container.ID+"/attach?stream=1&stdin=1&stdout=1&stderr=1", bytes.NewReader([]byte{}))
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- if err := postContainersAttach(srv, API_VERSION, r, req, map[string]string{"name": container.Id}); err != nil {
|
|
|
+ if err := postContainersAttach(srv, APIVERSION, r, req, map[string]string{"name": container.ID}); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
}()
|
|
@@ -1206,7 +1206,7 @@ func TestDeleteContainers(t *testing.T) {
|
|
|
srv := &Server{runtime: runtime}
|
|
|
|
|
|
container, err := NewBuilder(runtime).Create(&Config{
|
|
|
- Image: GetTestImage(runtime).Id,
|
|
|
+ Image: GetTestImage(runtime).ID,
|
|
|
Cmd: []string{"touch", "/test"},
|
|
|
})
|
|
|
if err != nil {
|
|
@@ -1218,19 +1218,19 @@ func TestDeleteContainers(t *testing.T) {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- req, err := http.NewRequest("DELETE", "/containers/"+container.Id, nil)
|
|
|
+ req, err := http.NewRequest("DELETE", "/containers/"+container.ID, nil)
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
r := httptest.NewRecorder()
|
|
|
- if err := deleteContainers(srv, API_VERSION, r, req, map[string]string{"name": container.Id}); err != nil {
|
|
|
+ if err := deleteContainers(srv, APIVERSION, r, req, map[string]string{"name": container.ID}); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
if r.Code != http.StatusNoContent {
|
|
|
t.Fatalf("%d NO CONTENT expected, received %d\n", http.StatusNoContent, r.Code)
|
|
|
}
|
|
|
|
|
|
- if c := runtime.Get(container.Id); c != nil {
|
|
|
+ if c := runtime.Get(container.ID); c != nil {
|
|
|
t.Fatalf("The container as not been deleted")
|
|
|
}
|
|
|
|