1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Update tests to reflect new project structure

This commit is contained in:
Guillaume J. Charmes 2013-05-15 01:52:09 +00:00
parent 9bb3dc9843
commit e7077320ff
5 changed files with 17 additions and 7 deletions

View file

@ -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()

View file

@ -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)
}

View file

@ -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)

View file

@ -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 {

View file

@ -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
}