Skip to content

Commit 6cec018

Browse files
committed
Include exception message in condition result when docker is unavailable
Closes gh-20582
1 parent c72dd7d commit 6cec018

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/testcontainers/DisabledIfDockerUnavailableCondition.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,15 +26,14 @@
2626
*
2727
* @author Andy Wilkinson
2828
* @author Phillip Webb
29+
* @author Moritz Halbritter
2930
*/
3031
class DisabledIfDockerUnavailableCondition implements ExecutionCondition {
3132

3233
private static final String SILENCE_PROPERTY = "visibleassertions.silence";
3334

3435
private static final ConditionEvaluationResult ENABLED = ConditionEvaluationResult.enabled("Docker available");
3536

36-
private static final ConditionEvaluationResult DISABLED = ConditionEvaluationResult.disabled("Docker unavailable");
37-
3837
@Override
3938
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
4039
String originalSilenceValue = System.getProperty(SILENCE_PROPERTY);
@@ -43,7 +42,7 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con
4342
return ENABLED;
4443
}
4544
catch (Throwable ex) {
46-
return DISABLED;
45+
return ConditionEvaluationResult.disabled("Docker unavailable", ex.getMessage());
4746
}
4847
finally {
4948
if (originalSilenceValue != null) {

0 commit comments

Comments
 (0)