Pārlūkot izejas kodu

Always return the correct test image.

And not a *random* one from its history.
Louis Opter 12 gadi atpakaļ
vecāks
revīzija
fe014a8e6c
1 mainītis faili ar 6 papildinājumiem un 3 dzēšanām
  1. 6 3
      runtime_test.go

+ 6 - 3
runtime_test.go

@@ -135,10 +135,13 @@ func GetTestImage(runtime *Runtime) *Image {
 	imgs, err := runtime.graph.All()
 	if err != nil {
 		panic(err)
-	} else if len(imgs) < 1 {
-		panic("GASP")
 	}
-	return imgs[0]
+	for i := range imgs {
+		if imgs[i].ID == unitTestImageId {
+			return imgs[i]
+		}
+	}
+	panic(fmt.Errorf("Test image %v not found", unitTestImageId))
 }
 
 func TestRuntimeCreate(t *testing.T) {