mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Include exception message in condition result when docker is unavailable
Closes gh-20582
This commit is contained in:
parent
c72dd7de1a
commit
6cec0187c3
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -26,6 +26,7 @@ import org.testcontainers.DockerClientFactory;
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @author Phillip Webb
|
||||
* @author Moritz Halbritter
|
||||
*/
|
||||
class DisabledIfDockerUnavailableCondition implements ExecutionCondition {
|
||||
|
||||
@ -33,8 +34,6 @@ class DisabledIfDockerUnavailableCondition implements ExecutionCondition {
|
||||
|
||||
private static final ConditionEvaluationResult ENABLED = ConditionEvaluationResult.enabled("Docker available");
|
||||
|
||||
private static final ConditionEvaluationResult DISABLED = ConditionEvaluationResult.disabled("Docker unavailable");
|
||||
|
||||
@Override
|
||||
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
|
||||
String originalSilenceValue = System.getProperty(SILENCE_PROPERTY);
|
||||
@ -43,7 +42,7 @@ class DisabledIfDockerUnavailableCondition implements ExecutionCondition {
|
||||
return ENABLED;
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
return DISABLED;
|
||||
return ConditionEvaluationResult.disabled("Docker unavailable", ex.getMessage());
|
||||
}
|
||||
finally {
|
||||
if (originalSilenceValue != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user