|
|
|
@ -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) {
|
|
|
|
|