Skip to content
This repository was archived by the owner on Jan 9, 2020. It is now read-only.

Commit 70fee6d

Browse files
committed
Wait for all containers to disappear before deleting images.
1 parent 9a6884e commit 70fee6d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

resource-managers/kubernetes/integration-tests/src/test/scala/org/apache/spark/deploy/k8s/integrationtest/docker/KubernetesSuiteDockerManager.scala

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ private[spark] class KubernetesSuiteDockerManager(
142142
}
143143

144144
/**
145-
* Forces all containers running an image with the configured tag to halt and be removed.
146-
*/
145+
* Forces all containers running an image with the configured tag to halt and be removed.
146+
*/
147147
private def removeRunningContainers(): Unit = {
148148
Eventually.eventually(KubernetesSuite.TIMEOUT, KubernetesSuite.INTERVAL) {
149149
val runningContainersWithImageTag = stopRunningContainers()
@@ -155,7 +155,15 @@ private[spark] class KubernetesSuiteDockerManager(
155155
dockerClient.listContainers(ListContainersParam.allContainers())
156156
.asScala
157157
.filter(containerHasImageWithTag(_))
158-
.foreach(container => dockerClient.removeContainer(container.id()))
158+
.foreach(container => dockerClient.removeContainer(
159+
container.id(), RemoveContainerParam.forceKill(true)))
160+
Eventually.eventually(KubernetesSuite.TIMEOUT, KubernetesSuite.INTERVAL) {
161+
val containersWithImageTag = dockerClient.listContainers(ListContainersParam.allContainers())
162+
.asScala
163+
.filter(containerHasImageWithTag(_))
164+
require(containersWithImageTag.isEmpty, s"${containersWithImageTag.size} containers still" +
165+
s" found with image tag $dockerTag.")
166+
}
159167

160168
}
161169

0 commit comments

Comments
 (0)