Increase readbility of unit tests by using mkRuntime everywhere

This commit is contained in:
Solomon Hykes 2013-10-18 06:44:30 +00:00
parent 5c175357aa
commit 07d9e4353b
2 changed files with 7 additions and 28 deletions

View File

@ -472,10 +472,7 @@ func TestGetContainersChanges(t *testing.T) {
func TestGetContainersTop(t *testing.T) { func TestGetContainersTop(t *testing.T) {
t.Skip("Fixme. Skipping test for now. Reported error when testing using dind: 'api_test.go:527: Expected 2 processes, found 0.'") t.Skip("Fixme. Skipping test for now. Reported error when testing using dind: 'api_test.go:527: Expected 2 processes, found 0.'")
runtime, err := newTestRuntime() runtime := mkRuntime(t)
if err != nil {
t.Fatal(err)
}
defer nuke(runtime) defer nuke(runtime)
srv := &Server{runtime: runtime} srv := &Server{runtime: runtime}

View File

@ -229,10 +229,7 @@ func TestBuild(t *testing.T) {
func buildImage(context testContextTemplate, t *testing.T, srv *Server, useCache bool) *Image { func buildImage(context testContextTemplate, t *testing.T, srv *Server, useCache bool) *Image {
if srv == nil { if srv == nil {
runtime, err := newTestRuntime() runtime := mkRuntime(t)
if err != nil {
t.Fatal(err)
}
defer nuke(runtime) defer nuke(runtime)
srv = &Server{ srv = &Server{
@ -370,10 +367,7 @@ func TestBuildEntrypoint(t *testing.T) {
// testing #1405 - config.Cmd does not get cleaned up if // testing #1405 - config.Cmd does not get cleaned up if
// utilizing cache // utilizing cache
func TestBuildEntrypointRunCleanup(t *testing.T) { func TestBuildEntrypointRunCleanup(t *testing.T) {
runtime, err := newTestRuntime() runtime := mkRuntime(t)
if err != nil {
t.Fatal(err)
}
defer nuke(runtime) defer nuke(runtime)
srv := &Server{ srv := &Server{
@ -402,10 +396,7 @@ func TestBuildEntrypointRunCleanup(t *testing.T) {
} }
func TestBuildImageWithCache(t *testing.T) { func TestBuildImageWithCache(t *testing.T) {
runtime, err := newTestRuntime() runtime := mkRuntime(t)
if err != nil {
t.Fatal(err)
}
defer nuke(runtime) defer nuke(runtime)
srv := &Server{ srv := &Server{
@ -433,10 +424,7 @@ func TestBuildImageWithCache(t *testing.T) {
} }
func TestBuildImageWithoutCache(t *testing.T) { func TestBuildImageWithoutCache(t *testing.T) {
runtime, err := newTestRuntime() runtime := mkRuntime(t)
if err != nil {
t.Fatal(err)
}
defer nuke(runtime) defer nuke(runtime)
srv := &Server{ srv := &Server{
@ -464,10 +452,7 @@ func TestBuildImageWithoutCache(t *testing.T) {
} }
func TestForbiddenContextPath(t *testing.T) { func TestForbiddenContextPath(t *testing.T) {
runtime, err := newTestRuntime() runtime := mkRuntime(t)
if err != nil {
t.Fatal(err)
}
defer nuke(runtime) defer nuke(runtime)
srv := &Server{ srv := &Server{
@ -513,10 +498,7 @@ func TestForbiddenContextPath(t *testing.T) {
} }
func TestBuildADDFileNotFound(t *testing.T) { func TestBuildADDFileNotFound(t *testing.T) {
runtime, err := newTestRuntime() runtime := mkRuntime(t)
if err != nil {
t.Fatal(err)
}
defer nuke(runtime) defer nuke(runtime)
srv := &Server{ srv := &Server{