Simplify check

This commit is contained in:
Tadgh 2021-01-18 21:53:14 -05:00
parent edbc789a93
commit 8d87f0f92b
2 changed files with 8 additions and 2 deletions

View File

@ -100,8 +100,13 @@
<artifactId>elasticsearch</artifactId> <artifactId>elasticsearch</artifactId>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>

View File

@ -3,6 +3,7 @@ package ca.uhn.fhir.test.utilities.docker;
import org.junit.jupiter.api.extension.ConditionEvaluationResult; import org.junit.jupiter.api.extension.ConditionEvaluationResult;
import org.junit.jupiter.api.extension.ExecutionCondition; import org.junit.jupiter.api.extension.ExecutionCondition;
import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ExtensionContext;
import org.testcontainers.DockerClientFactory;
import org.testcontainers.elasticsearch.ElasticsearchContainer; import org.testcontainers.elasticsearch.ElasticsearchContainer;
@ -14,7 +15,7 @@ public class DockerRequiredCondition implements ExecutionCondition {
@Override @Override
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext theExtensionContext) { public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext theExtensionContext) {
try { try {
new ElasticsearchContainer(); DockerClientFactory.instance().isDockerAvailable();
return ConditionEvaluationResult.enabled("Docker is installed so we can run these tests!"); return ConditionEvaluationResult.enabled("Docker is installed so we can run these tests!");
} catch (Exception e) { } catch (Exception e) {
return ConditionEvaluationResult.disabled("It appears as though docker is not installed on the host machine!"); return ConditionEvaluationResult.disabled("It appears as though docker is not installed on the host machine!");