-
Notifications
You must be signed in to change notification settings - Fork 231
/
remove_test.go
50 lines (40 loc) · 1.04 KB
/
remove_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"strings"
"testing"
)
func TestRemoveBuiltImage(t *testing.T) {
name := "testremoveimage"
runBuild(t, name, withDockerfile(`
FROM busybox
CMD echo test
`))
// make sure our new image is there
out := run(t, "ls")
if !strings.Contains(out, name) {
t.Fatalf("expected %s in ls output, got: %s", name, out)
}
// remove the image
run(t, "rm", name)
// make sure the image is not in ls output
out = run(t, "ls")
if strings.Contains(out, name) {
t.Fatalf("expected %s to not be in ls output after removal, got: %s", name, out)
}
}
func TestRemovePulledImage(t *testing.T) {
image := "debian:buster"
run(t, "pull", image)
// make sure our image is there
out := run(t, "ls")
if !strings.Contains(out, image) {
t.Fatalf("expected %s in ls output, got: %s", image, out)
}
// remove the image
run(t, "rm", image)
// make sure the image is not in ls output
out = run(t, "ls")
if strings.Contains(out, image) {
t.Fatalf("expected %s to not be in ls output after removal, got: %s", image, out)
}
}