github.com/mponton/terratest@v0.44.0/modules/docker/images_test.go (about) 1 package docker 2 3 import ( 4 "fmt" 5 "strings" 6 "testing" 7 8 "github.com/mponton/terratest/modules/random" 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func TestListImagesAndDeleteImage(t *testing.T) { 13 t.Parallel() 14 15 uniqueID := strings.ToLower(random.UniqueId()) 16 repo := "gruntwork-io/test-image" 17 tag := fmt.Sprintf("v1-%s", uniqueID) 18 img := fmt.Sprintf("%s:%s", repo, tag) 19 20 options := &BuildOptions{ 21 Tags: []string{img}, 22 } 23 Build(t, "../../test/fixtures/docker", options) 24 25 assert.True(t, DoesImageExist(t, img, nil)) 26 DeleteImage(t, img, nil) 27 assert.False(t, DoesImageExist(t, img, nil)) 28 }