diff --git a/container.go b/container.go index aa1acc3c4c..62d7ce064a 100644 --- a/container.go +++ b/container.go @@ -3,7 +3,7 @@ package docker import ( "encoding/json" "errors" - "github.com/dotcloud/docker/fs" + "./fs" "github.com/kr/pty" "io" "io/ioutil" diff --git a/container_test.go b/container_test.go index 0ffa65527f..a2c49006e7 100644 --- a/container_test.go +++ b/container_test.go @@ -15,6 +15,7 @@ func TestStart(t *testing.T) { if err != nil { t.Fatal(err) } + defer nuke(docker) container, err := docker.Create( "start_test", "ls", @@ -51,6 +52,7 @@ func TestRun(t *testing.T) { if err != nil { t.Fatal(err) } + defer nuke(docker) container, err := docker.Create( "run_test", "ls", @@ -81,6 +83,7 @@ func TestOutput(t *testing.T) { if err != nil { t.Fatal(err) } + defer nuke(docker) container, err := docker.Create( "output_test", "echo", @@ -106,6 +109,7 @@ func TestKill(t *testing.T) { if err != nil { t.Fatal(err) } + defer nuke(docker) container, err := docker.Create( "stop_test", "cat", @@ -148,6 +152,7 @@ func TestExitCode(t *testing.T) { if err != nil { t.Fatal(err) } + defer nuke(docker) trueContainer, err := docker.Create( "exit_test_1", @@ -193,6 +198,7 @@ func TestRestart(t *testing.T) { if err != nil { t.Fatal(err) } + defer nuke(docker) container, err := docker.Create( "restart_test", "echo", @@ -227,6 +233,7 @@ func TestRestartStdin(t *testing.T) { if err != nil { t.Fatal(err) } + defer nuke(docker) container, err := docker.Create( "restart_stdin_test", "cat", @@ -276,6 +283,7 @@ func TestUser(t *testing.T) { if err != nil { t.Fatal(err) } + defer nuke(docker) // Default user must be root container, err := docker.Create( @@ -393,6 +401,7 @@ func TestMultipleContainers(t *testing.T) { if err != nil { t.Fatal(err) } + defer nuke(docker) container1, err := docker.Create( "container1", @@ -449,6 +458,7 @@ func TestStdin(t *testing.T) { if err != nil { t.Fatal(err) } + defer nuke(docker) container, err := docker.Create( "stdin_test", "cat", @@ -484,6 +494,7 @@ func TestTty(t *testing.T) { if err != nil { t.Fatal(err) } + defer nuke(docker) container, err := docker.Create( "tty_test", "cat", @@ -519,6 +530,7 @@ func TestEnv(t *testing.T) { if err != nil { t.Fatal(err) } + defer nuke(docker) container, err := docker.Create( "env_test", "/usr/bin/env", @@ -568,6 +580,7 @@ func BenchmarkRunSequencial(b *testing.B) { if err != nil { b.Fatal(err) } + defer nuke(docker) for i := 0; i < b.N; i++ { container, err := docker.Create( fmt.Sprintf("bench_%v", i), @@ -598,6 +611,7 @@ func BenchmarkRunParallel(b *testing.B) { if err != nil { b.Fatal(err) } + defer nuke(docker) var tasks []chan error diff --git a/docker.go b/docker.go index 2561d73e11..49c6d83248 100644 --- a/docker.go +++ b/docker.go @@ -1,7 +1,7 @@ package docker import ( - "github.com/dotcloud/docker/fs" + "./fs" "container/list" "fmt" "io/ioutil" diff --git a/docker_test.go b/docker_test.go index befc0a9a3f..5e75906c5f 100644 --- a/docker_test.go +++ b/docker_test.go @@ -11,6 +11,10 @@ import ( const testLayerPath string = "/var/lib/docker/docker-ut.tar" +func nuke(docker *Docker) error { + return os.RemoveAll(docker.root) +} + func layerArchive(tarfile string) (io.Reader, error) { // FIXME: need to close f somewhere f, err := os.Open(tarfile) @@ -72,6 +76,7 @@ func TestCreate(t *testing.T) { if err != nil { t.Fatal(err) } + defer nuke(docker) // Make sure we start we 0 containers if len(docker.List()) != 0 { @@ -125,6 +130,7 @@ func TestDestroy(t *testing.T) { if err != nil { t.Fatal(err) } + defer nuke(docker) container, err := docker.Create( "test_destroy", "ls", @@ -173,6 +179,7 @@ func TestGet(t *testing.T) { if err != nil { t.Fatal(err) } + defer nuke(docker) container1, err := docker.Create( "test1", "ls", @@ -233,6 +240,7 @@ func TestRestore(t *testing.T) { if err != nil { t.Fatal(err) } + defer nuke(docker1) if layer, err := layerArchive(testLayerPath); err != nil { panic(err) @@ -268,6 +276,7 @@ func TestRestore(t *testing.T) { if err != nil { t.Fatal(err) } + defer nuke(docker2) if len(docker2.List()) != 1 { t.Errorf("Expected 1 container, %v found", len(docker2.List())) } diff --git a/fs/layers.go b/fs/layers.go index b7d97bd7f0..11452fcf2f 100644 --- a/fs/layers.go +++ b/fs/layers.go @@ -1,7 +1,7 @@ package fs import ( - "github.com/dotcloud/docker/future" + "../future" "errors" "fmt" "io" diff --git a/fs/store.go b/fs/store.go index c6612d9b19..ef275ecdd8 100644 --- a/fs/store.go +++ b/fs/store.go @@ -4,7 +4,7 @@ import ( "database/sql" "errors" "fmt" - "github.com/dotcloud/docker/future" + "../future" _ "github.com/mattn/go-sqlite3" "github.com/shykes/gorp" //Forked to implement CreateTablesOpts "io" diff --git a/state.go b/state.go index e864f304f9..e88298ec44 100644 --- a/state.go +++ b/state.go @@ -2,7 +2,7 @@ package docker import ( "fmt" - "github.com/dotcloud/docker/future" + "./future" "sync" "time" )