Search in sources :

Example 1 with AbstractImagePullPolicy

use of org.testcontainers.images.AbstractImagePullPolicy in project testcontainers-java by testcontainers.

the class OutOfPackageImagePullPolicyTest method shouldSupportCustomPoliciesOutOfTestContainersPackage.

@Test
public void shouldSupportCustomPoliciesOutOfTestContainersPackage() {
    try (GenericContainer<?> container = new GenericContainer<>(TINY_IMAGE).withImagePullPolicy(new AbstractImagePullPolicy() {

        @Override
        protected boolean shouldPullCached(DockerImageName imageName, ImageData localImageData) {
            return false;
        }
    })) {
        container.withStartupCheckStrategy(new OneShotStartupCheckStrategy());
        container.start();
    }
}
Also used : DockerImageName(org.testcontainers.utility.DockerImageName) ImageData(org.testcontainers.images.ImageData) AbstractImagePullPolicy(org.testcontainers.images.AbstractImagePullPolicy) OneShotStartupCheckStrategy(org.testcontainers.containers.startupcheck.OneShotStartupCheckStrategy) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 OneShotStartupCheckStrategy (org.testcontainers.containers.startupcheck.OneShotStartupCheckStrategy)1 AbstractImagePullPolicy (org.testcontainers.images.AbstractImagePullPolicy)1 ImageData (org.testcontainers.images.ImageData)1 DockerImageName (org.testcontainers.utility.DockerImageName)1