package main import ( "fmt" "net/http" "testing" ) func TestContainerPullImages(t *testing.T) { testDeploymentSpecs := []DeploymentSpec{ { // multiple existing images {App: "busybox", Version: "latest"}, {App: "alpine", Version: "3.12"}, }, { // non existing image {App: "busybox", Version: "unknown"}, }, } client := &podmanClient{} t.Run("pulling multiple images", func(t *testing.T) { if err := client.pullImages(testDeploymentSpecs[0], &http.Client{}, "http://localhost:8090/v1.0.0/libpod"); err != nil { t.Errorf(fmt.Sprintf("%s", err)) } }) t.Run("pulling non existing images", func(t *testing.T) { if err := client.pullImages(testDeploymentSpecs[1], &http.Client{}, "http://localhost:8090/v1.0.0/libpod"); err == nil { t.Errorf("Expected to get an error") } }) }