Signed-off-by: Vincent Demeester <vincent@sbr.pm>
| ... | ... |
@@ -275,4 +275,7 @@ func (s *DockerSuite) TestRestartAutoRemoveContainer(c *check.C) {
|
| 275 | 275 |
|
| 276 | 276 |
out, _ = dockerCmd(c, "ps") |
| 277 | 277 |
c.Assert(out, checker.Contains, id[:12], check.Commentf("container should be restarted instead of removed: %v", out))
|
| 278 |
+ |
|
| 279 |
+ // Kill the container to make sure it will be removed |
|
| 280 |
+ dockerCmd(c, "kill", id) |
|
| 278 | 281 |
} |
| ... | ... |
@@ -71,7 +71,7 @@ func (s *DockerSuite) TestRunLookupGoogleDNS(c *check.C) {
|
| 71 | 71 |
// nslookup isn't present in nanoserver. Hence just use PowerShell... |
| 72 | 72 |
dockerCmd(c, "run", WindowsBaseImage, "powershell", "Resolve-DNSName", "google.com") |
| 73 | 73 |
} else {
|
| 74 |
- dockerCmd(c, "run", DefaultImage, "nslookup", "google.com") |
|
| 74 |
+ dockerCmd(c, "run", "busybox", "nslookup", "google.com") |
|
| 75 | 75 |
} |
| 76 | 76 |
|
| 77 | 77 |
} |
| ... | ... |
@@ -22,16 +22,9 @@ var ( |
| 22 | 22 |
// path to containerd's ctr binary |
| 23 | 23 |
ctrBinary = "docker-containerd-ctr" |
| 24 | 24 |
|
| 25 |
- // the private registry image to use for tests involving the registry |
|
| 26 |
- registryImageName = "registry" |
|
| 27 |
- |
|
| 28 | 25 |
// the private registry to use for tests |
| 29 | 26 |
privateRegistryURL = "127.0.0.1:5000" |
| 30 | 27 |
|
| 31 |
- // TODO Windows CI. These are incorrect and need fixing into |
|
| 32 |
- // platform specific pieces. |
|
| 33 |
- runtimePath = "/var/run/docker" |
|
| 34 |
- |
|
| 35 | 28 |
workingDirectory string |
| 36 | 29 |
|
| 37 | 30 |
// isLocalDaemon is true if the daemon under test is on the same |
| ... | ... |
@@ -50,10 +43,6 @@ var ( |
| 50 | 50 |
// not support volumes, but TP4 did. |
| 51 | 51 |
windowsDaemonKV int |
| 52 | 52 |
|
| 53 |
- // daemonDefaultImage is the name of the default image to use when running |
|
| 54 |
- // tests. This is platform dependent. |
|
| 55 |
- daemonDefaultImage string |
|
| 56 |
- |
|
| 57 | 53 |
// For a local daemon on Linux, these values will be used for testing |
| 58 | 54 |
// user namespace support as the standard graph path(s) will be |
| 59 | 55 |
// appended with the root remapped uid.gid prefix |
| ... | ... |
@@ -81,12 +70,6 @@ var ( |
| 81 | 81 |
daemonPid int |
| 82 | 82 |
) |
| 83 | 83 |
|
| 84 |
-const ( |
|
| 85 |
- // DefaultImage is the name of the base image for the majority of tests that |
|
| 86 |
- // are run across suites |
|
| 87 |
- DefaultImage = "busybox" |
|
| 88 |
-) |
|
| 89 |
- |
|
| 90 | 84 |
func init() {
|
| 91 | 85 |
reexec.Init() |
| 92 | 86 |
if dockerBin := os.Getenv("DOCKER_BINARY"); dockerBin != "" {
|
| ... | ... |
@@ -98,9 +81,6 @@ func init() {
|
| 98 | 98 |
fmt.Printf("ERROR: couldn't resolve full path to the Docker binary (%v)\n", err)
|
| 99 | 99 |
os.Exit(1) |
| 100 | 100 |
} |
| 101 |
- if registryImage := os.Getenv("REGISTRY_IMAGE"); registryImage != "" {
|
|
| 102 |
- registryImageName = registryImage |
|
| 103 |
- } |
|
| 104 | 101 |
if registry := os.Getenv("REGISTRY_URL"); registry != "" {
|
| 105 | 102 |
privateRegistryURL = registry |
| 106 | 103 |
} |
| ... | ... |
@@ -358,12 +358,12 @@ func getAllVolumes() ([]*types.Volume, error) {
|
| 358 | 358 |
var protectedImages = map[string]struct{}{}
|
| 359 | 359 |
|
| 360 | 360 |
func deleteAllImages(c *check.C) {
|
| 361 |
- cmd := exec.Command(dockerBinary, "images") |
|
| 361 |
+ cmd := exec.Command(dockerBinary, "images", "--digests") |
|
| 362 | 362 |
cmd.Env = appendBaseEnv(true) |
| 363 | 363 |
out, err := cmd.CombinedOutput() |
| 364 | 364 |
c.Assert(err, checker.IsNil) |
| 365 | 365 |
lines := strings.Split(string(out), "\n")[1:] |
| 366 |
- var imgs []string |
|
| 366 |
+ imgMap := map[string]struct{}{}
|
|
| 367 | 367 |
for _, l := range lines {
|
| 368 | 368 |
if l == "" {
|
| 369 | 369 |
continue |
| ... | ... |
@@ -372,13 +372,22 @@ func deleteAllImages(c *check.C) {
|
| 372 | 372 |
imgTag := fields[0] + ":" + fields[1] |
| 373 | 373 |
if _, ok := protectedImages[imgTag]; !ok {
|
| 374 | 374 |
if fields[0] == "<none>" || fields[1] == "<none>" {
|
| 375 |
- imgs = append(imgs, fields[2]) |
|
| 376 |
- continue |
|
| 375 |
+ if fields[2] != "<none>" {
|
|
| 376 |
+ imgMap[fields[0]+"@"+fields[2]] = struct{}{}
|
|
| 377 |
+ } else {
|
|
| 378 |
+ imgMap[fields[3]] = struct{}{}
|
|
| 379 |
+ } |
|
| 380 |
+ // continue |
|
| 381 |
+ } else {
|
|
| 382 |
+ imgMap[imgTag] = struct{}{}
|
|
| 377 | 383 |
} |
| 378 |
- imgs = append(imgs, imgTag) |
|
| 379 | 384 |
} |
| 380 | 385 |
} |
| 381 |
- if len(imgs) != 0 {
|
|
| 386 |
+ if len(imgMap) != 0 {
|
|
| 387 |
+ imgs := make([]string, 0, len(imgMap)) |
|
| 388 |
+ for k := range imgMap {
|
|
| 389 |
+ imgs = append(imgs, k) |
|
| 390 |
+ } |
|
| 382 | 391 |
dockerCmd(c, append([]string{"rmi", "-f"}, imgs...)...)
|
| 383 | 392 |
} |
| 384 | 393 |
} |