File tree 3 files changed +25
-1
lines changed
main/java/org/testcontainers/images
test/java/org/testcontainers/images
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() {
40
40
.currentThread ()
41
41
.getContextClassLoader ()
42
42
.loadClass (imagePullPolicyClassName )
43
- .getConstructor ()
43
+ .getDeclaredConstructor ()
44
44
.newInstance ();
45
45
} catch (Exception e ) {
46
46
throw new IllegalArgumentException (
Original file line number Diff line number Diff line change @@ -51,4 +51,20 @@ public void simpleConfigurationTest() {
51
51
container .stop ();
52
52
}
53
53
}
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
+ }
54
70
}
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
38
38
pull.policy=com.mycompany.testcontainers.ExampleImagePullPolicy
39
39
```
40
40
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
+
41
49
Please see [ the documentation on configuration mechanisms] ( ./configuration.md ) for more information.
42
50
43
51
## Customizing the container
You can’t perform that action at this time.
0 commit comments