Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
| ... | ... |
@@ -1,9 +1,6 @@ |
| 1 | 1 |
package api |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- "fmt" |
|
| 5 |
- "net/http" |
|
| 6 |
- "net/http/httptest" |
|
| 7 | 4 |
"testing" |
| 8 | 5 |
) |
| 9 | 6 |
|
| ... | ... |
@@ -20,46 +17,3 @@ func TestJsonContentType(t *testing.T) {
|
| 20 | 20 |
t.Fail() |
| 21 | 21 |
} |
| 22 | 22 |
} |
| 23 |
- |
|
| 24 |
-func TestGetBoolParam(t *testing.T) {
|
|
| 25 |
- if ret, err := getBoolParam("true"); err != nil || !ret {
|
|
| 26 |
- t.Fatalf("true -> true, nil | got %t %s", ret, err)
|
|
| 27 |
- } |
|
| 28 |
- if ret, err := getBoolParam("True"); err != nil || !ret {
|
|
| 29 |
- t.Fatalf("True -> true, nil | got %t %s", ret, err)
|
|
| 30 |
- } |
|
| 31 |
- if ret, err := getBoolParam("1"); err != nil || !ret {
|
|
| 32 |
- t.Fatalf("1 -> true, nil | got %t %s", ret, err)
|
|
| 33 |
- } |
|
| 34 |
- if ret, err := getBoolParam(""); err != nil || ret {
|
|
| 35 |
- t.Fatalf("\"\" -> false, nil | got %t %s", ret, err)
|
|
| 36 |
- } |
|
| 37 |
- if ret, err := getBoolParam("false"); err != nil || ret {
|
|
| 38 |
- t.Fatalf("false -> false, nil | got %t %s", ret, err)
|
|
| 39 |
- } |
|
| 40 |
- if ret, err := getBoolParam("0"); err != nil || ret {
|
|
| 41 |
- t.Fatalf("0 -> false, nil | got %t %s", ret, err)
|
|
| 42 |
- } |
|
| 43 |
- if ret, err := getBoolParam("faux"); err == nil || ret {
|
|
| 44 |
- t.Fatalf("faux -> false, err | got %t %s", ret, err)
|
|
| 45 |
- } |
|
| 46 |
-} |
|
| 47 |
- |
|
| 48 |
-func TesthttpError(t *testing.T) {
|
|
| 49 |
- r := httptest.NewRecorder() |
|
| 50 |
- |
|
| 51 |
- httpError(r, fmt.Errorf("No such method"))
|
|
| 52 |
- if r.Code != http.StatusNotFound {
|
|
| 53 |
- t.Fatalf("Expected %d, got %d", http.StatusNotFound, r.Code)
|
|
| 54 |
- } |
|
| 55 |
- |
|
| 56 |
- httpError(r, fmt.Errorf("This accound hasn't been activated"))
|
|
| 57 |
- if r.Code != http.StatusForbidden {
|
|
| 58 |
- t.Fatalf("Expected %d, got %d", http.StatusForbidden, r.Code)
|
|
| 59 |
- } |
|
| 60 |
- |
|
| 61 |
- httpError(r, fmt.Errorf("Some error"))
|
|
| 62 |
- if r.Code != http.StatusInternalServerError {
|
|
| 63 |
- t.Fatalf("Expected %d, got %d", http.StatusInternalServerError, r.Code)
|
|
| 64 |
- } |
|
| 65 |
-} |
| 66 | 23 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,52 @@ |
| 0 |
+package server |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "fmt" |
|
| 4 |
+ "net/http" |
|
| 5 |
+ "net/http/httptest" |
|
| 6 |
+ "testing" |
|
| 7 |
+) |
|
| 8 |
+ |
|
| 9 |
+func TestGetBoolParam(t *testing.T) {
|
|
| 10 |
+ if ret, err := getBoolParam("true"); err != nil || !ret {
|
|
| 11 |
+ t.Fatalf("true -> true, nil | got %t %s", ret, err)
|
|
| 12 |
+ } |
|
| 13 |
+ if ret, err := getBoolParam("True"); err != nil || !ret {
|
|
| 14 |
+ t.Fatalf("True -> true, nil | got %t %s", ret, err)
|
|
| 15 |
+ } |
|
| 16 |
+ if ret, err := getBoolParam("1"); err != nil || !ret {
|
|
| 17 |
+ t.Fatalf("1 -> true, nil | got %t %s", ret, err)
|
|
| 18 |
+ } |
|
| 19 |
+ if ret, err := getBoolParam(""); err != nil || ret {
|
|
| 20 |
+ t.Fatalf("\"\" -> false, nil | got %t %s", ret, err)
|
|
| 21 |
+ } |
|
| 22 |
+ if ret, err := getBoolParam("false"); err != nil || ret {
|
|
| 23 |
+ t.Fatalf("false -> false, nil | got %t %s", ret, err)
|
|
| 24 |
+ } |
|
| 25 |
+ if ret, err := getBoolParam("0"); err != nil || ret {
|
|
| 26 |
+ t.Fatalf("0 -> false, nil | got %t %s", ret, err)
|
|
| 27 |
+ } |
|
| 28 |
+ if ret, err := getBoolParam("faux"); err == nil || ret {
|
|
| 29 |
+ t.Fatalf("faux -> false, err | got %t %s", ret, err)
|
|
| 30 |
+ |
|
| 31 |
+ } |
|
| 32 |
+} |
|
| 33 |
+ |
|
| 34 |
+func TesthttpError(t *testing.T) {
|
|
| 35 |
+ r := httptest.NewRecorder() |
|
| 36 |
+ |
|
| 37 |
+ httpError(r, fmt.Errorf("No such method"))
|
|
| 38 |
+ if r.Code != http.StatusNotFound {
|
|
| 39 |
+ t.Fatalf("Expected %d, got %d", http.StatusNotFound, r.Code)
|
|
| 40 |
+ } |
|
| 41 |
+ |
|
| 42 |
+ httpError(r, fmt.Errorf("This accound hasn't been activated"))
|
|
| 43 |
+ if r.Code != http.StatusForbidden {
|
|
| 44 |
+ t.Fatalf("Expected %d, got %d", http.StatusForbidden, r.Code)
|
|
| 45 |
+ } |
|
| 46 |
+ |
|
| 47 |
+ httpError(r, fmt.Errorf("Some error"))
|
|
| 48 |
+ if r.Code != http.StatusInternalServerError {
|
|
| 49 |
+ t.Fatalf("Expected %d, got %d", http.StatusInternalServerError, r.Code)
|
|
| 50 |
+ } |
|
| 51 |
+} |
| ... | ... |
@@ -5,14 +5,6 @@ import ( |
| 5 | 5 |
"bytes" |
| 6 | 6 |
"encoding/json" |
| 7 | 7 |
"fmt" |
| 8 |
- "github.com/dotcloud/docker/api" |
|
| 9 |
- "github.com/dotcloud/docker/dockerversion" |
|
| 10 |
- "github.com/dotcloud/docker/engine" |
|
| 11 |
- "github.com/dotcloud/docker/image" |
|
| 12 |
- "github.com/dotcloud/docker/runconfig" |
|
| 13 |
- "github.com/dotcloud/docker/runtime" |
|
| 14 |
- "github.com/dotcloud/docker/utils" |
|
| 15 |
- "github.com/dotcloud/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar" |
|
| 16 | 8 |
"io" |
| 17 | 9 |
"io/ioutil" |
| 18 | 10 |
"net" |
| ... | ... |
@@ -21,6 +13,16 @@ import ( |
| 21 | 21 |
"strings" |
| 22 | 22 |
"testing" |
| 23 | 23 |
"time" |
| 24 |
+ |
|
| 25 |
+ "github.com/dotcloud/docker/api" |
|
| 26 |
+ "github.com/dotcloud/docker/api/server" |
|
| 27 |
+ "github.com/dotcloud/docker/dockerversion" |
|
| 28 |
+ "github.com/dotcloud/docker/engine" |
|
| 29 |
+ "github.com/dotcloud/docker/image" |
|
| 30 |
+ "github.com/dotcloud/docker/runconfig" |
|
| 31 |
+ "github.com/dotcloud/docker/runtime" |
|
| 32 |
+ "github.com/dotcloud/docker/utils" |
|
| 33 |
+ "github.com/dotcloud/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar" |
|
| 24 | 34 |
) |
| 25 | 35 |
|
| 26 | 36 |
func TestGetVersion(t *testing.T) {
|
| ... | ... |
@@ -35,7 +37,7 @@ func TestGetVersion(t *testing.T) {
|
| 35 | 35 |
t.Fatal(err) |
| 36 | 36 |
} |
| 37 | 37 |
// FIXME getting the version should require an actual running Server |
| 38 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 38 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 39 | 39 |
t.Fatal(err) |
| 40 | 40 |
} |
| 41 | 41 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -77,7 +79,7 @@ func TestGetInfo(t *testing.T) {
|
| 77 | 77 |
} |
| 78 | 78 |
r := httptest.NewRecorder() |
| 79 | 79 |
|
| 80 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 80 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 81 | 81 |
t.Fatal(err) |
| 82 | 82 |
} |
| 83 | 83 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -125,7 +127,7 @@ func TestGetEvents(t *testing.T) {
|
| 125 | 125 |
|
| 126 | 126 |
r := httptest.NewRecorder() |
| 127 | 127 |
setTimeout(t, "", 500*time.Millisecond, func() {
|
| 128 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 128 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 129 | 129 |
t.Fatal(err) |
| 130 | 130 |
} |
| 131 | 131 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -166,7 +168,7 @@ func TestGetImagesJSON(t *testing.T) {
|
| 166 | 166 |
|
| 167 | 167 |
r := httptest.NewRecorder() |
| 168 | 168 |
|
| 169 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 169 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 170 | 170 |
t.Fatal(err) |
| 171 | 171 |
} |
| 172 | 172 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -201,7 +203,7 @@ func TestGetImagesJSON(t *testing.T) {
|
| 201 | 201 |
if err != nil {
|
| 202 | 202 |
t.Fatal(err) |
| 203 | 203 |
} |
| 204 |
- if err := api.ServeRequest(eng, api.APIVERSION, r2, req2); err != nil {
|
|
| 204 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r2, req2); err != nil {
|
|
| 205 | 205 |
t.Fatal(err) |
| 206 | 206 |
} |
| 207 | 207 |
assertHttpNotError(r2, t) |
| ... | ... |
@@ -234,7 +236,7 @@ func TestGetImagesJSON(t *testing.T) {
|
| 234 | 234 |
t.Fatal(err) |
| 235 | 235 |
} |
| 236 | 236 |
|
| 237 |
- if err := api.ServeRequest(eng, api.APIVERSION, r3, req3); err != nil {
|
|
| 237 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r3, req3); err != nil {
|
|
| 238 | 238 |
t.Fatal(err) |
| 239 | 239 |
} |
| 240 | 240 |
assertHttpNotError(r3, t) |
| ... | ... |
@@ -259,7 +261,7 @@ func TestGetImagesHistory(t *testing.T) {
|
| 259 | 259 |
if err != nil {
|
| 260 | 260 |
t.Fatal(err) |
| 261 | 261 |
} |
| 262 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 262 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 263 | 263 |
t.Fatal(err) |
| 264 | 264 |
} |
| 265 | 265 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -283,7 +285,7 @@ func TestGetImagesByName(t *testing.T) {
|
| 283 | 283 |
} |
| 284 | 284 |
|
| 285 | 285 |
r := httptest.NewRecorder() |
| 286 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 286 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 287 | 287 |
t.Fatal(err) |
| 288 | 288 |
} |
| 289 | 289 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -327,7 +329,7 @@ func TestGetContainersJSON(t *testing.T) {
|
| 327 | 327 |
} |
| 328 | 328 |
|
| 329 | 329 |
r := httptest.NewRecorder() |
| 330 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 330 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 331 | 331 |
t.Fatal(err) |
| 332 | 332 |
} |
| 333 | 333 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -363,7 +365,7 @@ func TestGetContainersExport(t *testing.T) {
|
| 363 | 363 |
if err != nil {
|
| 364 | 364 |
t.Fatal(err) |
| 365 | 365 |
} |
| 366 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 366 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 367 | 367 |
t.Fatal(err) |
| 368 | 368 |
} |
| 369 | 369 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -401,7 +403,7 @@ func TestSaveImageAndThenLoad(t *testing.T) {
|
| 401 | 401 |
if err != nil {
|
| 402 | 402 |
t.Fatal(err) |
| 403 | 403 |
} |
| 404 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 404 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 405 | 405 |
t.Fatal(err) |
| 406 | 406 |
} |
| 407 | 407 |
if r.Code != http.StatusOK {
|
| ... | ... |
@@ -415,7 +417,7 @@ func TestSaveImageAndThenLoad(t *testing.T) {
|
| 415 | 415 |
if err != nil {
|
| 416 | 416 |
t.Fatal(err) |
| 417 | 417 |
} |
| 418 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 418 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 419 | 419 |
t.Fatal(err) |
| 420 | 420 |
} |
| 421 | 421 |
if r.Code != http.StatusOK {
|
| ... | ... |
@@ -428,7 +430,7 @@ func TestSaveImageAndThenLoad(t *testing.T) {
|
| 428 | 428 |
if err != nil {
|
| 429 | 429 |
t.Fatal(err) |
| 430 | 430 |
} |
| 431 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 431 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 432 | 432 |
t.Fatal(err) |
| 433 | 433 |
} |
| 434 | 434 |
if r.Code != http.StatusNotFound {
|
| ... | ... |
@@ -441,7 +443,7 @@ func TestSaveImageAndThenLoad(t *testing.T) {
|
| 441 | 441 |
if err != nil {
|
| 442 | 442 |
t.Fatal(err) |
| 443 | 443 |
} |
| 444 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 444 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 445 | 445 |
t.Fatal(err) |
| 446 | 446 |
} |
| 447 | 447 |
if r.Code != http.StatusOK {
|
| ... | ... |
@@ -454,7 +456,7 @@ func TestSaveImageAndThenLoad(t *testing.T) {
|
| 454 | 454 |
if err != nil {
|
| 455 | 455 |
t.Fatal(err) |
| 456 | 456 |
} |
| 457 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 457 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 458 | 458 |
t.Fatal(err) |
| 459 | 459 |
} |
| 460 | 460 |
if r.Code != http.StatusOK {
|
| ... | ... |
@@ -481,7 +483,7 @@ func TestGetContainersChanges(t *testing.T) {
|
| 481 | 481 |
if err != nil {
|
| 482 | 482 |
t.Fatal(err) |
| 483 | 483 |
} |
| 484 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 484 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 485 | 485 |
t.Fatal(err) |
| 486 | 486 |
} |
| 487 | 487 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -548,7 +550,7 @@ func TestGetContainersTop(t *testing.T) {
|
| 548 | 548 |
if err != nil {
|
| 549 | 549 |
t.Fatal(err) |
| 550 | 550 |
} |
| 551 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 551 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 552 | 552 |
t.Fatal(err) |
| 553 | 553 |
} |
| 554 | 554 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -596,7 +598,7 @@ func TestGetContainersByName(t *testing.T) {
|
| 596 | 596 |
if err != nil {
|
| 597 | 597 |
t.Fatal(err) |
| 598 | 598 |
} |
| 599 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 599 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 600 | 600 |
t.Fatal(err) |
| 601 | 601 |
} |
| 602 | 602 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -631,7 +633,7 @@ func TestPostCommit(t *testing.T) {
|
| 631 | 631 |
} |
| 632 | 632 |
|
| 633 | 633 |
r := httptest.NewRecorder() |
| 634 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 634 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 635 | 635 |
t.Fatal(err) |
| 636 | 636 |
} |
| 637 | 637 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -667,7 +669,7 @@ func TestPostContainersCreate(t *testing.T) {
|
| 667 | 667 |
} |
| 668 | 668 |
|
| 669 | 669 |
r := httptest.NewRecorder() |
| 670 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 670 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 671 | 671 |
t.Fatal(err) |
| 672 | 672 |
} |
| 673 | 673 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -716,7 +718,7 @@ func TestPostContainersKill(t *testing.T) {
|
| 716 | 716 |
if err != nil {
|
| 717 | 717 |
t.Fatal(err) |
| 718 | 718 |
} |
| 719 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 719 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 720 | 720 |
t.Fatal(err) |
| 721 | 721 |
} |
| 722 | 722 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -755,7 +757,7 @@ func TestPostContainersRestart(t *testing.T) {
|
| 755 | 755 |
t.Fatal(err) |
| 756 | 756 |
} |
| 757 | 757 |
r := httptest.NewRecorder() |
| 758 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 758 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 759 | 759 |
t.Fatal(err) |
| 760 | 760 |
} |
| 761 | 761 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -797,7 +799,7 @@ func TestPostContainersStart(t *testing.T) {
|
| 797 | 797 |
req.Header.Set("Content-Type", "application/json")
|
| 798 | 798 |
|
| 799 | 799 |
r := httptest.NewRecorder() |
| 800 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 800 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 801 | 801 |
t.Fatal(err) |
| 802 | 802 |
} |
| 803 | 803 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -814,7 +816,7 @@ func TestPostContainersStart(t *testing.T) {
|
| 814 | 814 |
} |
| 815 | 815 |
|
| 816 | 816 |
r = httptest.NewRecorder() |
| 817 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 817 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 818 | 818 |
t.Fatal(err) |
| 819 | 819 |
} |
| 820 | 820 |
// Starting an already started container should return an error |
| ... | ... |
@@ -852,7 +854,7 @@ func TestRunErrorBindMountRootSource(t *testing.T) {
|
| 852 | 852 |
req.Header.Set("Content-Type", "application/json")
|
| 853 | 853 |
|
| 854 | 854 |
r := httptest.NewRecorder() |
| 855 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 855 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 856 | 856 |
t.Fatal(err) |
| 857 | 857 |
} |
| 858 | 858 |
if r.Code != http.StatusInternalServerError {
|
| ... | ... |
@@ -889,7 +891,7 @@ func TestPostContainersStop(t *testing.T) {
|
| 889 | 889 |
t.Fatal(err) |
| 890 | 890 |
} |
| 891 | 891 |
r := httptest.NewRecorder() |
| 892 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 892 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 893 | 893 |
t.Fatal(err) |
| 894 | 894 |
} |
| 895 | 895 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -921,7 +923,7 @@ func TestPostContainersWait(t *testing.T) {
|
| 921 | 921 |
if err != nil {
|
| 922 | 922 |
t.Fatal(err) |
| 923 | 923 |
} |
| 924 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 924 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 925 | 925 |
t.Fatal(err) |
| 926 | 926 |
} |
| 927 | 927 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -979,7 +981,7 @@ func TestPostContainersAttach(t *testing.T) {
|
| 979 | 979 |
t.Fatal(err) |
| 980 | 980 |
} |
| 981 | 981 |
|
| 982 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 982 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 983 | 983 |
t.Fatal(err) |
| 984 | 984 |
} |
| 985 | 985 |
assertHttpNotError(r.ResponseRecorder, t) |
| ... | ... |
@@ -1057,7 +1059,7 @@ func TestPostContainersAttachStderr(t *testing.T) {
|
| 1057 | 1057 |
t.Fatal(err) |
| 1058 | 1058 |
} |
| 1059 | 1059 |
|
| 1060 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 1060 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 1061 | 1061 |
t.Fatal(err) |
| 1062 | 1062 |
} |
| 1063 | 1063 |
assertHttpNotError(r.ResponseRecorder, t) |
| ... | ... |
@@ -1114,7 +1116,7 @@ func TestDeleteContainers(t *testing.T) {
|
| 1114 | 1114 |
t.Fatal(err) |
| 1115 | 1115 |
} |
| 1116 | 1116 |
r := httptest.NewRecorder() |
| 1117 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 1117 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 1118 | 1118 |
t.Fatal(err) |
| 1119 | 1119 |
} |
| 1120 | 1120 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -1133,7 +1135,7 @@ func TestOptionsRoute(t *testing.T) {
|
| 1133 | 1133 |
if err != nil {
|
| 1134 | 1134 |
t.Fatal(err) |
| 1135 | 1135 |
} |
| 1136 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 1136 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 1137 | 1137 |
t.Fatal(err) |
| 1138 | 1138 |
} |
| 1139 | 1139 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -1152,7 +1154,7 @@ func TestGetEnabledCors(t *testing.T) {
|
| 1152 | 1152 |
if err != nil {
|
| 1153 | 1153 |
t.Fatal(err) |
| 1154 | 1154 |
} |
| 1155 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 1155 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 1156 | 1156 |
t.Fatal(err) |
| 1157 | 1157 |
} |
| 1158 | 1158 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -1199,7 +1201,7 @@ func TestDeleteImages(t *testing.T) {
|
| 1199 | 1199 |
} |
| 1200 | 1200 |
|
| 1201 | 1201 |
r := httptest.NewRecorder() |
| 1202 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 1202 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 1203 | 1203 |
t.Fatal(err) |
| 1204 | 1204 |
} |
| 1205 | 1205 |
if r.Code != http.StatusConflict {
|
| ... | ... |
@@ -1212,7 +1214,7 @@ func TestDeleteImages(t *testing.T) {
|
| 1212 | 1212 |
} |
| 1213 | 1213 |
|
| 1214 | 1214 |
r2 := httptest.NewRecorder() |
| 1215 |
- if err := api.ServeRequest(eng, api.APIVERSION, r2, req2); err != nil {
|
|
| 1215 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r2, req2); err != nil {
|
|
| 1216 | 1216 |
t.Fatal(err) |
| 1217 | 1217 |
} |
| 1218 | 1218 |
assertHttpNotError(r2, t) |
| ... | ... |
@@ -1264,7 +1266,7 @@ func TestPostContainersCopy(t *testing.T) {
|
| 1264 | 1264 |
t.Fatal(err) |
| 1265 | 1265 |
} |
| 1266 | 1266 |
req.Header.Add("Content-Type", "application/json")
|
| 1267 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 1267 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 1268 | 1268 |
t.Fatal(err) |
| 1269 | 1269 |
} |
| 1270 | 1270 |
assertHttpNotError(r, t) |
| ... | ... |
@@ -1312,7 +1314,7 @@ func TestPostContainersCopyWhenContainerNotFound(t *testing.T) {
|
| 1312 | 1312 |
t.Fatal(err) |
| 1313 | 1313 |
} |
| 1314 | 1314 |
req.Header.Add("Content-Type", "application/json")
|
| 1315 |
- if err := api.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 1315 |
+ if err := server.ServeRequest(eng, api.APIVERSION, r, req); err != nil {
|
|
| 1316 | 1316 |
t.Fatal(err) |
| 1317 | 1317 |
} |
| 1318 | 1318 |
if r.Code != http.StatusNotFound {
|
| ... | ... |
@@ -3,7 +3,7 @@ package docker |
| 3 | 3 |
import ( |
| 4 | 4 |
"bufio" |
| 5 | 5 |
"fmt" |
| 6 |
- "github.com/dotcloud/docker/api" |
|
| 6 |
+ "github.com/dotcloud/docker/api/client" |
|
| 7 | 7 |
"github.com/dotcloud/docker/engine" |
| 8 | 8 |
"github.com/dotcloud/docker/image" |
| 9 | 9 |
"github.com/dotcloud/docker/pkg/term" |
| ... | ... |
@@ -121,7 +121,7 @@ func assertPipe(input, output string, r io.Reader, w io.Writer, count int) error |
| 121 | 121 |
func TestRunHostname(t *testing.T) {
|
| 122 | 122 |
stdout, stdoutPipe := io.Pipe() |
| 123 | 123 |
|
| 124 |
- cli := api.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 124 |
+ cli := client.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 125 | 125 |
defer cleanup(globalEngine, t) |
| 126 | 126 |
|
| 127 | 127 |
c := make(chan struct{})
|
| ... | ... |
@@ -166,7 +166,7 @@ func TestRunHostname(t *testing.T) {
|
| 166 | 166 |
func TestRunWorkdir(t *testing.T) {
|
| 167 | 167 |
stdout, stdoutPipe := io.Pipe() |
| 168 | 168 |
|
| 169 |
- cli := api.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 169 |
+ cli := client.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 170 | 170 |
defer cleanup(globalEngine, t) |
| 171 | 171 |
|
| 172 | 172 |
c := make(chan struct{})
|
| ... | ... |
@@ -211,7 +211,7 @@ func TestRunWorkdir(t *testing.T) {
|
| 211 | 211 |
func TestRunWorkdirExists(t *testing.T) {
|
| 212 | 212 |
stdout, stdoutPipe := io.Pipe() |
| 213 | 213 |
|
| 214 |
- cli := api.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 214 |
+ cli := client.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 215 | 215 |
defer cleanup(globalEngine, t) |
| 216 | 216 |
|
| 217 | 217 |
c := make(chan struct{})
|
| ... | ... |
@@ -255,7 +255,7 @@ func TestRunWorkdirExists(t *testing.T) {
|
| 255 | 255 |
// TestRunWorkdirExistsAndIsFile checks that if 'docker run -w' with existing file can be detected |
| 256 | 256 |
func TestRunWorkdirExistsAndIsFile(t *testing.T) {
|
| 257 | 257 |
|
| 258 |
- cli := api.NewDockerCli(nil, nil, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 258 |
+ cli := client.NewDockerCli(nil, nil, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 259 | 259 |
defer cleanup(globalEngine, t) |
| 260 | 260 |
|
| 261 | 261 |
c := make(chan struct{})
|
| ... | ... |
@@ -275,7 +275,7 @@ func TestRunExit(t *testing.T) {
|
| 275 | 275 |
stdin, stdinPipe := io.Pipe() |
| 276 | 276 |
stdout, stdoutPipe := io.Pipe() |
| 277 | 277 |
|
| 278 |
- cli := api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 278 |
+ cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 279 | 279 |
defer cleanup(globalEngine, t) |
| 280 | 280 |
|
| 281 | 281 |
c1 := make(chan struct{})
|
| ... | ... |
@@ -328,7 +328,7 @@ func TestRunDisconnect(t *testing.T) {
|
| 328 | 328 |
stdin, stdinPipe := io.Pipe() |
| 329 | 329 |
stdout, stdoutPipe := io.Pipe() |
| 330 | 330 |
|
| 331 |
- cli := api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 331 |
+ cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 332 | 332 |
defer cleanup(globalEngine, t) |
| 333 | 333 |
|
| 334 | 334 |
c1 := make(chan struct{})
|
| ... | ... |
@@ -374,7 +374,7 @@ func TestRunDisconnectTty(t *testing.T) {
|
| 374 | 374 |
stdin, stdinPipe := io.Pipe() |
| 375 | 375 |
stdout, stdoutPipe := io.Pipe() |
| 376 | 376 |
|
| 377 |
- cli := api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 377 |
+ cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 378 | 378 |
defer cleanup(globalEngine, t) |
| 379 | 379 |
|
| 380 | 380 |
c1 := make(chan struct{})
|
| ... | ... |
@@ -426,7 +426,7 @@ func TestRunAttachStdin(t *testing.T) {
|
| 426 | 426 |
stdin, stdinPipe := io.Pipe() |
| 427 | 427 |
stdout, stdoutPipe := io.Pipe() |
| 428 | 428 |
|
| 429 |
- cli := api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 429 |
+ cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 430 | 430 |
defer cleanup(globalEngine, t) |
| 431 | 431 |
|
| 432 | 432 |
ch := make(chan struct{})
|
| ... | ... |
@@ -490,7 +490,7 @@ func TestRunDetach(t *testing.T) {
|
| 490 | 490 |
stdin, stdinPipe := io.Pipe() |
| 491 | 491 |
stdout, stdoutPipe := io.Pipe() |
| 492 | 492 |
|
| 493 |
- cli := api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 493 |
+ cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 494 | 494 |
defer cleanup(globalEngine, t) |
| 495 | 495 |
|
| 496 | 496 |
ch := make(chan struct{})
|
| ... | ... |
@@ -537,7 +537,7 @@ func TestAttachDetach(t *testing.T) {
|
| 537 | 537 |
stdin, stdinPipe := io.Pipe() |
| 538 | 538 |
stdout, stdoutPipe := io.Pipe() |
| 539 | 539 |
|
| 540 |
- cli := api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 540 |
+ cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 541 | 541 |
defer cleanup(globalEngine, t) |
| 542 | 542 |
|
| 543 | 543 |
ch := make(chan struct{})
|
| ... | ... |
@@ -570,7 +570,7 @@ func TestAttachDetach(t *testing.T) {
|
| 570 | 570 |
|
| 571 | 571 |
stdin, stdinPipe = io.Pipe() |
| 572 | 572 |
stdout, stdoutPipe = io.Pipe() |
| 573 |
- cli = api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 573 |
+ cli = client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 574 | 574 |
|
| 575 | 575 |
ch = make(chan struct{})
|
| 576 | 576 |
go func() {
|
| ... | ... |
@@ -618,7 +618,7 @@ func TestAttachDetachTruncatedID(t *testing.T) {
|
| 618 | 618 |
stdin, stdinPipe := io.Pipe() |
| 619 | 619 |
stdout, stdoutPipe := io.Pipe() |
| 620 | 620 |
|
| 621 |
- cli := api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 621 |
+ cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 622 | 622 |
defer cleanup(globalEngine, t) |
| 623 | 623 |
|
| 624 | 624 |
// Discard the CmdRun output |
| ... | ... |
@@ -636,7 +636,7 @@ func TestAttachDetachTruncatedID(t *testing.T) {
|
| 636 | 636 |
|
| 637 | 637 |
stdin, stdinPipe = io.Pipe() |
| 638 | 638 |
stdout, stdoutPipe = io.Pipe() |
| 639 |
- cli = api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 639 |
+ cli = client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 640 | 640 |
|
| 641 | 641 |
ch := make(chan struct{})
|
| 642 | 642 |
go func() {
|
| ... | ... |
@@ -683,7 +683,7 @@ func TestAttachDisconnect(t *testing.T) {
|
| 683 | 683 |
stdin, stdinPipe := io.Pipe() |
| 684 | 684 |
stdout, stdoutPipe := io.Pipe() |
| 685 | 685 |
|
| 686 |
- cli := api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 686 |
+ cli := client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 687 | 687 |
defer cleanup(globalEngine, t) |
| 688 | 688 |
|
| 689 | 689 |
go func() {
|
| ... | ... |
@@ -752,7 +752,7 @@ func TestAttachDisconnect(t *testing.T) {
|
| 752 | 752 |
func TestRunAutoRemove(t *testing.T) {
|
| 753 | 753 |
t.Skip("Fixme. Skipping test for now, race condition")
|
| 754 | 754 |
stdout, stdoutPipe := io.Pipe() |
| 755 |
- cli := api.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 755 |
+ cli := client.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 756 | 756 |
defer cleanup(globalEngine, t) |
| 757 | 757 |
|
| 758 | 758 |
c := make(chan struct{})
|
| ... | ... |
@@ -788,7 +788,7 @@ func TestRunAutoRemove(t *testing.T) {
|
| 788 | 788 |
|
| 789 | 789 |
func TestCmdLogs(t *testing.T) {
|
| 790 | 790 |
t.Skip("Test not impemented")
|
| 791 |
- cli := api.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 791 |
+ cli := client.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 792 | 792 |
defer cleanup(globalEngine, t) |
| 793 | 793 |
|
| 794 | 794 |
if err := cli.CmdRun(unitTestImageID, "sh", "-c", "ls -l"); err != nil {
|
| ... | ... |
@@ -806,7 +806,7 @@ func TestCmdLogs(t *testing.T) {
|
| 806 | 806 |
// Expected behaviour: error out when attempting to bind mount non-existing source paths |
| 807 | 807 |
func TestRunErrorBindNonExistingSource(t *testing.T) {
|
| 808 | 808 |
|
| 809 |
- cli := api.NewDockerCli(nil, nil, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 809 |
+ cli := client.NewDockerCli(nil, nil, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 810 | 810 |
defer cleanup(globalEngine, t) |
| 811 | 811 |
|
| 812 | 812 |
c := make(chan struct{})
|
| ... | ... |
@@ -826,7 +826,7 @@ func TestRunErrorBindNonExistingSource(t *testing.T) {
|
| 826 | 826 |
func TestImagesViz(t *testing.T) {
|
| 827 | 827 |
stdout, stdoutPipe := io.Pipe() |
| 828 | 828 |
|
| 829 |
- cli := api.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 829 |
+ cli := client.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 830 | 830 |
defer cleanup(globalEngine, t) |
| 831 | 831 |
|
| 832 | 832 |
image := buildTestImages(t, globalEngine) |
| ... | ... |
@@ -876,7 +876,7 @@ func TestImagesViz(t *testing.T) {
|
| 876 | 876 |
func TestImagesTree(t *testing.T) {
|
| 877 | 877 |
stdout, stdoutPipe := io.Pipe() |
| 878 | 878 |
|
| 879 |
- cli := api.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 879 |
+ cli := client.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 880 | 880 |
defer cleanup(globalEngine, t) |
| 881 | 881 |
|
| 882 | 882 |
image := buildTestImages(t, globalEngine) |
| ... | ... |
@@ -959,7 +959,7 @@ func TestRunCidFileCheckIDLength(t *testing.T) {
|
| 959 | 959 |
} |
| 960 | 960 |
tmpCidFile := path.Join(tmpDir, "cid") |
| 961 | 961 |
|
| 962 |
- cli := api.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 962 |
+ cli := client.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 963 | 963 |
defer cleanup(globalEngine, t) |
| 964 | 964 |
|
| 965 | 965 |
c := make(chan struct{})
|
| ... | ... |
@@ -1008,7 +1008,7 @@ func TestRunCidFileCleanupIfEmpty(t *testing.T) {
|
| 1008 | 1008 |
} |
| 1009 | 1009 |
tmpCidFile := path.Join(tmpDir, "cid") |
| 1010 | 1010 |
|
| 1011 |
- cli := api.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 1011 |
+ cli := client.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 1012 | 1012 |
defer cleanup(globalEngine, t) |
| 1013 | 1013 |
|
| 1014 | 1014 |
c := make(chan struct{})
|
| ... | ... |
@@ -1038,7 +1038,7 @@ func TestContainerOrphaning(t *testing.T) {
|
| 1038 | 1038 |
defer os.RemoveAll(tmpDir) |
| 1039 | 1039 |
|
| 1040 | 1040 |
// setup a CLI and server |
| 1041 |
- cli := api.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 1041 |
+ cli := client.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 1042 | 1042 |
defer cleanup(globalEngine, t) |
| 1043 | 1043 |
srv := mkServerFromEngine(globalEngine, t) |
| 1044 | 1044 |
|
| ... | ... |
@@ -1098,8 +1098,8 @@ func TestCmdKill(t *testing.T) {
|
| 1098 | 1098 |
var ( |
| 1099 | 1099 |
stdin, stdinPipe = io.Pipe() |
| 1100 | 1100 |
stdout, stdoutPipe = io.Pipe() |
| 1101 |
- cli = api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 1102 |
- cli2 = api.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 1101 |
+ cli = client.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 1102 |
+ cli2 = client.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, testDaemonAddr, nil) |
|
| 1103 | 1103 |
) |
| 1104 | 1104 |
defer cleanup(globalEngine, t) |
| 1105 | 1105 |
|
| ... | ... |
@@ -3,7 +3,7 @@ package docker |
| 3 | 3 |
import ( |
| 4 | 4 |
"crypto/tls" |
| 5 | 5 |
"crypto/x509" |
| 6 |
- "github.com/dotcloud/docker/api" |
|
| 6 |
+ "github.com/dotcloud/docker/api/client" |
|
| 7 | 7 |
"io/ioutil" |
| 8 | 8 |
"testing" |
| 9 | 9 |
"time" |
| ... | ... |
@@ -35,7 +35,7 @@ func getTlsConfig(certFile, keyFile string, t *testing.T) *tls.Config {
|
| 35 | 35 |
|
| 36 | 36 |
// TestHttpsInfo connects via two-way authenticated HTTPS to the info endpoint |
| 37 | 37 |
func TestHttpsInfo(t *testing.T) {
|
| 38 |
- cli := api.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, |
|
| 38 |
+ cli := client.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, |
|
| 39 | 39 |
testDaemonHttpsAddr, getTlsConfig("client-cert.pem", "client-key.pem", t))
|
| 40 | 40 |
|
| 41 | 41 |
setTimeout(t, "Reading command output time out", 10*time.Second, func() {
|
| ... | ... |
@@ -48,7 +48,7 @@ func TestHttpsInfo(t *testing.T) {
|
| 48 | 48 |
// TestHttpsInfoRogueCert connects via two-way authenticated HTTPS to the info endpoint |
| 49 | 49 |
// by using a rogue client certificate and checks that it fails with the expected error. |
| 50 | 50 |
func TestHttpsInfoRogueCert(t *testing.T) {
|
| 51 |
- cli := api.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, |
|
| 51 |
+ cli := client.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, |
|
| 52 | 52 |
testDaemonHttpsAddr, getTlsConfig("client-rogue-cert.pem", "client-rogue-key.pem", t))
|
| 53 | 53 |
|
| 54 | 54 |
setTimeout(t, "Reading command output time out", 10*time.Second, func() {
|
| ... | ... |
@@ -65,7 +65,7 @@ func TestHttpsInfoRogueCert(t *testing.T) {
|
| 65 | 65 |
// TestHttpsInfoRogueServerCert connects via two-way authenticated HTTPS to the info endpoint |
| 66 | 66 |
// which provides a rogue server certificate and checks that it fails with the expected error |
| 67 | 67 |
func TestHttpsInfoRogueServerCert(t *testing.T) {
|
| 68 |
- cli := api.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, |
|
| 68 |
+ cli := client.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, |
|
| 69 | 69 |
testDaemonRogueHttpsAddr, getTlsConfig("client-cert.pem", "client-key.pem", t))
|
| 70 | 70 |
|
| 71 | 71 |
setTimeout(t, "Reading command output time out", 10*time.Second, func() {
|