Skip to content

Change image used for test to avoid image name cache preventing proper pull#3378

Merged
rnorth merged 1 commit intomasterfrom
fix-ambiguous-pull-test
Oct 22, 2020
Merged

Change image used for test to avoid image name cache preventing proper pull#3378
rnorth merged 1 commit intomasterfrom
fix-ambiguous-pull-test

Conversation

@rnorth
Copy link
Copy Markdown
Member

@rnorth rnorth commented Oct 21, 2020

To fix build errors like this one, which I believe is happening when alpine:latest is recorded as present in Testcontainers' image name cache:

Gradle Test Executor 1 > org.testcontainers.dockerclient.AmbiguousImagePullTest > testNotUsingParse FAILED
    org.testcontainers.containers.ContainerLaunchException: Container startup failed
        at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:331)
        at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:312)
        at org.testcontainers.dockerclient.AmbiguousImagePullTest.testNotUsingParse(AmbiguousImagePullTest.java:30)

        Caused by:
        org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
            at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88)
            at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:324)
            ... 2 more

            Caused by:
            org.testcontainers.containers.ContainerLaunchException: Could not create/start container
                at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:498)
                at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:326)
                at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
                ... 3 more

                Caused by:
                com.github.dockerjava.api.exception.NotFoundException: Status 404: {"message":"No such image: alpine:latest"}
                    at com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:241)
                    at com.github.dockerjava.core.DefaultInvocationBuilder.post(DefaultInvocationBuilder.java:125)
                    at com.github.dockerjava.core.exec.CreateContainerCmdExec.execute(CreateContainerCmdExec.java:33)
                    at com.github.dockerjava.core.exec.CreateContainerCmdExec.execute(CreateContainerCmdExec.java:13)
                    at com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
                    at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:35)
                    at com.github.dockerjava.core.command.CreateContainerCmdImpl.exec(CreateContainerCmdImpl.java:595)
                    at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:408)
                    ... 5 more

@rnorth rnorth requested review from bsideup and kiview as code owners October 21, 2020 18:20
DockerClient client = DockerClientFactory.instance().client();
List<Image> alpineImages = client.listImagesCmd()
.withImageNameFilter("alpine:latest")
.withImageNameFilter("testcontainers/helloworld:latest")
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We never use the latest tag of this image anywhere else, so we can safely use it here without worrying about it being recorded in the cache of available images.

@rnorth rnorth force-pushed the fix-ambiguous-pull-test branch from 99ba2c3 to 6bdbd76 Compare October 21, 2020 18:28
@rnorth rnorth merged commit c110086 into master Oct 22, 2020
@rnorth rnorth deleted the fix-ambiguous-pull-test branch October 22, 2020 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants