Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Oct 22, 2020

Conversation

rnorth
Copy link
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

@@ -16,14 +16,14 @@
public void testNotUsingParse() {
DockerClient client = DockerClientFactory.instance().client();
List<Image> alpineImages = client.listImagesCmd()
.withImageNameFilter("alpine:latest")
.withImageNameFilter("testcontainers/helloworld:latest")
Copy link
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 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.

None yet

2 participants