@@ -66,7 +66,7 @@ public class DockerClientFactory {
66
66
DockerClient dockerClient ;
67
67
68
68
@ VisibleForTesting
69
- RuntimeException cachedChecksFailure ;
69
+ RuntimeException cachedClientFailure ;
70
70
71
71
private String activeApiVersion ;
72
72
private String activeExecutionDriver ;
@@ -139,9 +139,9 @@ public DockerClient client() {
139
139
}
140
140
141
141
// fail-fast if checks have failed previously
142
- if (cachedChecksFailure != null ) {
143
- log .debug ("There is a cached checks failure - throwing" , cachedChecksFailure );
144
- throw cachedChecksFailure ;
142
+ if (cachedClientFailure != null ) {
143
+ log .debug ("There is a cached checks failure - throwing" , cachedClientFailure );
144
+ throw cachedClientFailure ;
145
145
}
146
146
147
147
final DockerClientProviderStrategy strategy = getOrInitializeStrategy ();
@@ -170,7 +170,12 @@ public void close() {
170
170
boolean useRyuk = !Boolean .parseBoolean (System .getenv ("TESTCONTAINERS_RYUK_DISABLED" ));
171
171
if (useRyuk ) {
172
172
log .debug ("Ryuk is enabled" );
173
- ryukContainerId = ResourceReaper .start (hostIpAddress , client );
173
+ try {
174
+ ryukContainerId = ResourceReaper .start (hostIpAddress , client );
175
+ } catch (RuntimeException e ) {
176
+ cachedClientFailure = e ;
177
+ throw e ;
178
+ }
174
179
log .info ("Ryuk started - will monitor and terminate Testcontainers containers on JVM exit" );
175
180
} else {
176
181
log .debug ("Ryuk is disabled" );
@@ -201,7 +206,7 @@ public void close() {
201
206
);
202
207
}
203
208
} catch (RuntimeException e ) {
204
- cachedChecksFailure = e ;
209
+ cachedClientFailure = e ;
205
210
throw e ;
206
211
}
207
212
} else {
0 commit comments