Browse code

Increase readbility of unit tests by using mkRuntime everywhere

Solomon Hykes authored on 2013/10/18 15:44:30
Showing 2 changed files
... ...
@@ -472,10 +472,7 @@ func TestGetContainersChanges(t *testing.T) {
472 472
 
473 473
 func TestGetContainersTop(t *testing.T) {
474 474
 	t.Skip("Fixme. Skipping test for now. Reported error when testing using dind: 'api_test.go:527: Expected 2 processes, found 0.'")
475
-	runtime, err := newTestRuntime()
476
-	if err != nil {
477
-		t.Fatal(err)
478
-	}
475
+	runtime := mkRuntime(t)
479 476
 	defer nuke(runtime)
480 477
 
481 478
 	srv := &Server{runtime: runtime}
... ...
@@ -229,10 +229,7 @@ func TestBuild(t *testing.T) {
229 229
 
230 230
 func buildImage(context testContextTemplate, t *testing.T, srv *Server, useCache bool) *Image {
231 231
 	if srv == nil {
232
-		runtime, err := newTestRuntime()
233
-		if err != nil {
234
-			t.Fatal(err)
235
-		}
232
+		runtime := mkRuntime(t)
236 233
 		defer nuke(runtime)
237 234
 
238 235
 		srv = &Server{
... ...
@@ -370,10 +367,7 @@ func TestBuildEntrypoint(t *testing.T) {
370 370
 // testing #1405 - config.Cmd does not get cleaned up if
371 371
 // utilizing cache
372 372
 func TestBuildEntrypointRunCleanup(t *testing.T) {
373
-	runtime, err := newTestRuntime()
374
-	if err != nil {
375
-		t.Fatal(err)
376
-	}
373
+	runtime := mkRuntime(t)
377 374
 	defer nuke(runtime)
378 375
 
379 376
 	srv := &Server{
... ...
@@ -402,10 +396,7 @@ func TestBuildEntrypointRunCleanup(t *testing.T) {
402 402
 }
403 403
 
404 404
 func TestBuildImageWithCache(t *testing.T) {
405
-	runtime, err := newTestRuntime()
406
-	if err != nil {
407
-		t.Fatal(err)
408
-	}
405
+	runtime := mkRuntime(t)
409 406
 	defer nuke(runtime)
410 407
 
411 408
 	srv := &Server{
... ...
@@ -433,10 +424,7 @@ func TestBuildImageWithCache(t *testing.T) {
433 433
 }
434 434
 
435 435
 func TestBuildImageWithoutCache(t *testing.T) {
436
-	runtime, err := newTestRuntime()
437
-	if err != nil {
438
-		t.Fatal(err)
439
-	}
436
+	runtime := mkRuntime(t)
440 437
 	defer nuke(runtime)
441 438
 
442 439
 	srv := &Server{
... ...
@@ -464,10 +452,7 @@ func TestBuildImageWithoutCache(t *testing.T) {
464 464
 }
465 465
 
466 466
 func TestForbiddenContextPath(t *testing.T) {
467
-	runtime, err := newTestRuntime()
468
-	if err != nil {
469
-		t.Fatal(err)
470
-	}
467
+	runtime := mkRuntime(t)
471 468
 	defer nuke(runtime)
472 469
 
473 470
 	srv := &Server{
... ...
@@ -513,10 +498,7 @@ func TestForbiddenContextPath(t *testing.T) {
513 513
 }
514 514
 
515 515
 func TestBuildADDFileNotFound(t *testing.T) {
516
-	runtime, err := newTestRuntime()
517
-	if err != nil {
518
-		t.Fatal(err)
519
-	}
516
+	runtime := mkRuntime(t)
520 517
 	defer nuke(runtime)
521 518
 
522 519
 	srv := &Server{