diff --git a/api_test.go b/api_test.go index 0151c98b66..e432c8538d 100644 --- a/api_test.go +++ b/api_test.go @@ -6,6 +6,8 @@ import ( "bytes" "encoding/json" "github.com/dotcloud/docker/auth" + "github.com/dotcloud/docker/registry" + "github.com/dotcloud/docker/utils" "io" "net" "net/http" @@ -222,7 +224,10 @@ func TestGetImagesSearch(t *testing.T) { } defer nuke(runtime) - srv := &Server{runtime: runtime} + srv := &Server{ + runtime: runtime, + registry: registry.NewRegistry(runtime.authConfig), + } r := httptest.NewRecorder() diff --git a/builder_test.go b/builder_test.go index 08b7dd58cc..e3a24e86ec 100644 --- a/builder_test.go +++ b/builder_test.go @@ -1,6 +1,7 @@ package docker import ( + "github.com/dotcloud/docker/utils" "strings" "testing" ) @@ -24,7 +25,7 @@ func TestBuild(t *testing.T) { builder := NewBuilder(runtime) - img, err := builder.Build(strings.NewReader(Dockerfile), &nopWriter{}) + img, err := builder.Build(strings.NewReader(Dockerfile), &utils.NopWriter{}) if err != nil { t.Fatal(err) } diff --git a/graph_test.go b/graph_test.go index 19c6c07cf2..7c1e5c0978 100644 --- a/graph_test.go +++ b/graph_test.go @@ -4,6 +4,7 @@ import ( "archive/tar" "bytes" "errors" + "github.com/dotcloud/docker/utils" "io" "io/ioutil" "os" @@ -155,7 +156,7 @@ func TestDeletePrefix(t *testing.T) { graph := tempGraph(t) defer os.RemoveAll(graph.Root) img := createTestImage(graph, t) - if err := graph.Delete(TruncateId(img.Id)); err != nil { + if err := graph.Delete(utils.TruncateId(img.Id)); err != nil { t.Fatal(err) } assertNImages(graph, t, 0) diff --git a/runtime_test.go b/runtime_test.go index 64956baa67..cb94fcc330 100644 --- a/runtime_test.go +++ b/runtime_test.go @@ -2,6 +2,8 @@ package docker import ( "fmt" + "github.com/dotcloud/docker/registry" + "github.com/dotcloud/docker/utils" "io" "io/ioutil" "net" @@ -48,7 +50,7 @@ func layerArchive(tarfile string) (io.Reader, error) { func init() { // Hack to run sys init during unit testing - if SelfPath() == "/sbin/init" { + if utils.SelfPath() == "/sbin/init" { SysInit() return } @@ -69,7 +71,8 @@ func init() { // Create the "Server" srv := &Server{ - runtime: runtime, + runtime: runtime, + registry: registry.NewRegistry(runtime.authConfig), } // Retrieve the Image if err := srv.ImagePull(unitTestImageName, "", "", os.Stdout); err != nil { diff --git a/utils/utils.go b/utils/utils.go index 25c40807c4..5e9543be8a 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -151,10 +151,10 @@ func SelfPath() string { return path } -type nopWriter struct { +type NopWriter struct { } -func (w *nopWriter) Write(buf []byte) (int, error) { +func (w *NopWriter) Write(buf []byte) (int, error) { return len(buf), nil }