File tree Expand file tree Collapse file tree 3 files changed +25
-1
lines changed
main/java/org/testcontainers/images
test/java/org/testcontainers/images Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ public static synchronized ImagePullPolicy defaultPolicy() {
4040 .currentThread ()
4141 .getContextClassLoader ()
4242 .loadClass (imagePullPolicyClassName )
43- .getConstructor ()
43+ .getDeclaredConstructor ()
4444 .newInstance ();
4545 } catch (Exception e ) {
4646 throw new IllegalArgumentException (
Original file line number Diff line number Diff line change @@ -51,4 +51,20 @@ public void simpleConfigurationTest() {
5151 container .stop ();
5252 }
5353 }
54+
55+ @ Test
56+ public void alwaysPullConfigurationTest () {
57+ Mockito
58+ .doReturn (AlwaysPullPolicy .class .getCanonicalName ())
59+ .when (TestcontainersConfiguration .getInstance ())
60+ .getImagePullPolicy ();
61+
62+ try (DockerRegistryContainer registry = new DockerRegistryContainer ()) {
63+ registry .start ();
64+ GenericContainer <?> container = new GenericContainer <>(registry .createImage ()).withExposedPorts (8080 );
65+ container .start ();
66+ assertThat (container .getImage ().imagePullPolicy ).isInstanceOf (AlwaysPullPolicy .class );
67+ container .stop ();
68+ }
69+ }
5470}
Original file line number Diff line number Diff line change @@ -38,6 +38,14 @@ You can also configure Testcontainers to use your custom implementation by using
3838 pull.policy=com.mycompany.testcontainers.ExampleImagePullPolicy
3939 ```
4040
41+ You can also use the provided implementation to always pull images
42+
43+ === "` src/test/resources/testcontainers.properties ` "
44+ ```text
45+ pull.policy=org.testcontainers.images.AlwaysPullPolicy
46+ ```
47+
48+
4149Please see [ the documentation on configuration mechanisms] ( ./configuration.md ) for more information.
4250
4351## Customizing the container
You can’t perform that action at this time.
0 commit comments