Skip to content

Commit

Permalink
Change image used for test to avoid image name cache preventing prope…
Browse files Browse the repository at this point in the history
…r pull
  • Loading branch information
rnorth committed Oct 21, 2020
1 parent eeecf94 commit 6bdbd76
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.junit.Test;
import org.testcontainers.DockerClientFactory;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.startupcheck.OneShotStartupCheckStrategy;
import org.testcontainers.utility.DockerImageName;

import java.util.List;
Expand All @@ -16,16 +15,15 @@ public class AmbiguousImagePullTest {
public void testNotUsingParse() {
DockerClient client = DockerClientFactory.instance().client();
List<Image> alpineImages = client.listImagesCmd()
.withImageNameFilter("alpine:latest")
.withImageNameFilter("testcontainers/helloworld:latest")
.exec();
for (Image alpineImage : alpineImages) {
client.removeImageCmd(alpineImage.getId()).exec();
}

try (
final GenericContainer<?> container = new GenericContainer<>(DockerImageName.parse("alpine"))
.withCommand("/bin/sh", "-c", "sleep 0")
.withStartupCheckStrategy(new OneShotStartupCheckStrategy())
final GenericContainer<?> container = new GenericContainer<>(DockerImageName.parse("testcontainers/helloworld"))
.withExposedPorts(8080)
) {
container.start();
// do nothing other than start and stop
Expand Down

0 comments on commit 6bdbd76

Please sign in to comment.