func listImages(client dckr.Client, t *testing.T) []dckr.Image { imgs, err := client.ListImages() if err != nil { t.Error("List Image Error: ", err) t.Fail() } return imgs }
func buildImage(client dckr.Client, t *testing.T) dckr.Image { img, err := client.BuildImage("./docker_test") if err != nil { t.Error("build image failed: ", err) t.Fail() } log.Println("built image:", img) return img }
func listContainers(client dckr.Client, t *testing.T) []dckr.Container { containers, err := client.ListContainers() if err != nil { t.Error("list containers failed: ", err) t.Fail() } log.Println("list containers success: ", containers) return containers }
func inspectContainer(client dckr.Client, contID dckr.ContainerID, t *testing.T) dckr.Container { cont, err := client.InspectContainer(contID) if err != nil { t.Error("inspect container failed: ", err) t.Fail() } log.Println("inspect container success: ", cont) return cont }
func executeImage(client dckr.Client, imgid dckr.ImageID, t *testing.T) dckr.ContainerID { containerID, err := client.ExecuteImage(imgid, nil) if err != nil { t.Error("starting image failed: ", err) t.Fail() } log.Println("starting image success: ", imgid) return containerID }