|
@@ -4,6 +4,7 @@ import (
|
|
|
"bufio"
|
|
|
"fmt"
|
|
|
"github.com/dotcloud/docker"
|
|
|
+ "github.com/dotcloud/docker/api"
|
|
|
"github.com/dotcloud/docker/engine"
|
|
|
"github.com/dotcloud/docker/pkg/term"
|
|
|
"github.com/dotcloud/docker/utils"
|
|
@@ -119,7 +120,7 @@ func assertPipe(input, output string, r io.Reader, w io.Writer, count int) error
|
|
|
func TestRunHostname(t *testing.T) {
|
|
|
stdout, stdoutPipe := io.Pipe()
|
|
|
|
|
|
- cli := docker.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
|
|
|
c := make(chan struct{})
|
|
@@ -164,7 +165,7 @@ func TestRunHostname(t *testing.T) {
|
|
|
func TestRunWorkdir(t *testing.T) {
|
|
|
stdout, stdoutPipe := io.Pipe()
|
|
|
|
|
|
- cli := docker.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
|
|
|
c := make(chan struct{})
|
|
@@ -209,7 +210,7 @@ func TestRunWorkdir(t *testing.T) {
|
|
|
func TestRunWorkdirExists(t *testing.T) {
|
|
|
stdout, stdoutPipe := io.Pipe()
|
|
|
|
|
|
- cli := docker.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
|
|
|
c := make(chan struct{})
|
|
@@ -254,7 +255,7 @@ func TestRunExit(t *testing.T) {
|
|
|
stdin, stdinPipe := io.Pipe()
|
|
|
stdout, stdoutPipe := io.Pipe()
|
|
|
|
|
|
- cli := docker.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
|
|
|
c1 := make(chan struct{})
|
|
@@ -307,7 +308,7 @@ func TestRunDisconnect(t *testing.T) {
|
|
|
stdin, stdinPipe := io.Pipe()
|
|
|
stdout, stdoutPipe := io.Pipe()
|
|
|
|
|
|
- cli := docker.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
|
|
|
c1 := make(chan struct{})
|
|
@@ -353,7 +354,7 @@ func TestRunDisconnectTty(t *testing.T) {
|
|
|
stdin, stdinPipe := io.Pipe()
|
|
|
stdout, stdoutPipe := io.Pipe()
|
|
|
|
|
|
- cli := docker.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
|
|
|
c1 := make(chan struct{})
|
|
@@ -405,7 +406,7 @@ func TestRunAttachStdin(t *testing.T) {
|
|
|
stdin, stdinPipe := io.Pipe()
|
|
|
stdout, stdoutPipe := io.Pipe()
|
|
|
|
|
|
- cli := docker.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
|
|
|
ch := make(chan struct{})
|
|
@@ -469,7 +470,7 @@ func TestRunDetach(t *testing.T) {
|
|
|
stdin, stdinPipe := io.Pipe()
|
|
|
stdout, stdoutPipe := io.Pipe()
|
|
|
|
|
|
- cli := docker.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
|
|
|
ch := make(chan struct{})
|
|
@@ -516,7 +517,7 @@ func TestAttachDetach(t *testing.T) {
|
|
|
stdin, stdinPipe := io.Pipe()
|
|
|
stdout, stdoutPipe := io.Pipe()
|
|
|
|
|
|
- cli := docker.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
|
|
|
ch := make(chan struct{})
|
|
@@ -549,7 +550,7 @@ func TestAttachDetach(t *testing.T) {
|
|
|
|
|
|
stdin, stdinPipe = io.Pipe()
|
|
|
stdout, stdoutPipe = io.Pipe()
|
|
|
- cli = docker.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli = api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
|
|
|
ch = make(chan struct{})
|
|
|
go func() {
|
|
@@ -597,7 +598,7 @@ func TestAttachDetachTruncatedID(t *testing.T) {
|
|
|
stdin, stdinPipe := io.Pipe()
|
|
|
stdout, stdoutPipe := io.Pipe()
|
|
|
|
|
|
- cli := docker.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
|
|
|
// Discard the CmdRun output
|
|
@@ -615,7 +616,7 @@ func TestAttachDetachTruncatedID(t *testing.T) {
|
|
|
|
|
|
stdin, stdinPipe = io.Pipe()
|
|
|
stdout, stdoutPipe = io.Pipe()
|
|
|
- cli = docker.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli = api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
|
|
|
ch := make(chan struct{})
|
|
|
go func() {
|
|
@@ -662,7 +663,7 @@ func TestAttachDisconnect(t *testing.T) {
|
|
|
stdin, stdinPipe := io.Pipe()
|
|
|
stdout, stdoutPipe := io.Pipe()
|
|
|
|
|
|
- cli := docker.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
|
|
|
go func() {
|
|
@@ -731,7 +732,7 @@ func TestAttachDisconnect(t *testing.T) {
|
|
|
func TestRunAutoRemove(t *testing.T) {
|
|
|
t.Skip("Fixme. Skipping test for now, race condition")
|
|
|
stdout, stdoutPipe := io.Pipe()
|
|
|
- cli := docker.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
|
|
|
c := make(chan struct{})
|
|
@@ -767,7 +768,7 @@ func TestRunAutoRemove(t *testing.T) {
|
|
|
|
|
|
func TestCmdLogs(t *testing.T) {
|
|
|
t.Skip("Test not impemented")
|
|
|
- cli := docker.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
|
|
|
if err := cli.CmdRun(unitTestImageID, "sh", "-c", "ls -l"); err != nil {
|
|
@@ -785,7 +786,7 @@ func TestCmdLogs(t *testing.T) {
|
|
|
// Expected behaviour: error out when attempting to bind mount non-existing source paths
|
|
|
func TestRunErrorBindNonExistingSource(t *testing.T) {
|
|
|
|
|
|
- cli := docker.NewDockerCli(nil, nil, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(nil, nil, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
|
|
|
c := make(chan struct{})
|
|
@@ -805,7 +806,7 @@ func TestRunErrorBindNonExistingSource(t *testing.T) {
|
|
|
func TestImagesViz(t *testing.T) {
|
|
|
stdout, stdoutPipe := io.Pipe()
|
|
|
|
|
|
- cli := docker.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
|
|
|
image := buildTestImages(t, globalEngine)
|
|
@@ -855,7 +856,7 @@ func TestImagesViz(t *testing.T) {
|
|
|
func TestImagesTree(t *testing.T) {
|
|
|
stdout, stdoutPipe := io.Pipe()
|
|
|
|
|
|
- cli := docker.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
|
|
|
image := buildTestImages(t, globalEngine)
|
|
@@ -938,7 +939,7 @@ func TestRunCidFile(t *testing.T) {
|
|
|
}
|
|
|
tmpCidFile := path.Join(tmpDir, "cid")
|
|
|
|
|
|
- cli := docker.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(nil, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
|
|
|
c := make(chan struct{})
|
|
@@ -988,7 +989,7 @@ func TestContainerOrphaning(t *testing.T) {
|
|
|
defer os.RemoveAll(tmpDir)
|
|
|
|
|
|
// setup a CLI and server
|
|
|
- cli := docker.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
srv := mkServerFromEngine(globalEngine, t)
|
|
|
|
|
@@ -1045,8 +1046,8 @@ func TestCmdKill(t *testing.T) {
|
|
|
stdin, stdinPipe := io.Pipe()
|
|
|
stdout, stdoutPipe := io.Pipe()
|
|
|
|
|
|
- cli := docker.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
- cli2 := docker.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli := api.NewDockerCli(stdin, stdoutPipe, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
+ cli2 := api.NewDockerCli(nil, ioutil.Discard, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
|
|
defer cleanup(globalEngine, t)
|
|
|
|
|
|
ch := make(chan struct{})
|