mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
replace panic by log.Fatal in tests
This commit is contained in:
parent
d5f9160441
commit
823174de4d
1 changed files with 6 additions and 5 deletions
|
@ -88,7 +88,7 @@ func init() {
|
||||||
|
|
||||||
// Make it our Store root
|
// Make it our Store root
|
||||||
if runtime, err := NewRuntimeFromDirectory(unitTestStoreBase, false); err != nil {
|
if runtime, err := NewRuntimeFromDirectory(unitTestStoreBase, false); err != nil {
|
||||||
panic(err)
|
log.Fatalf("Unable to create a runtime for tests:", err)
|
||||||
} else {
|
} else {
|
||||||
globalRuntime = runtime
|
globalRuntime = runtime
|
||||||
}
|
}
|
||||||
|
@ -104,13 +104,13 @@ func init() {
|
||||||
if img, err := globalRuntime.repositories.LookupImage(unitTestImageName); err != nil || img.ID != unitTestImageID {
|
if img, err := globalRuntime.repositories.LookupImage(unitTestImageName); err != nil || img.ID != unitTestImageID {
|
||||||
// Retrieve the Image
|
// Retrieve the Image
|
||||||
if err := srv.ImagePull(unitTestImageName, "", os.Stdout, utils.NewStreamFormatter(false), nil, nil, true); err != nil {
|
if err := srv.ImagePull(unitTestImageName, "", os.Stdout, utils.NewStreamFormatter(false), nil, nil, true); err != nil {
|
||||||
panic(err)
|
log.Fatalf("Unable to pull the test image:", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Spawn a Daemon
|
// Spawn a Daemon
|
||||||
go func() {
|
go func() {
|
||||||
if err := ListenAndServe(testDaemonProto, testDaemonAddr, srv, os.Getenv("DEBUG") != ""); err != nil {
|
if err := ListenAndServe(testDaemonProto, testDaemonAddr, srv, os.Getenv("DEBUG") != ""); err != nil {
|
||||||
panic(err)
|
log.Fatalf("Unable to spawn the test daemon:", err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -125,14 +125,15 @@ func init() {
|
||||||
func GetTestImage(runtime *Runtime) *Image {
|
func GetTestImage(runtime *Runtime) *Image {
|
||||||
imgs, err := runtime.graph.Map()
|
imgs, err := runtime.graph.Map()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
log.Fatalf("Unable to get the test image:", err)
|
||||||
}
|
}
|
||||||
for _, image := range imgs {
|
for _, image := range imgs {
|
||||||
if image.ID == unitTestImageID {
|
if image.ID == unitTestImageID {
|
||||||
return image
|
return image
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
panic(fmt.Errorf("Test image %v not found", unitTestImageID))
|
log.Fatalf("Test image %v not found", unitTestImageID)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRuntimeCreate(t *testing.T) {
|
func TestRuntimeCreate(t *testing.T) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue