Merge pull request #2704 from hapifhir/2703-@RequiresDocker-annotation-check-fails
Fix DockerRequiredCondition check.
This commit is contained in:
commit
d574c4625b
|
@ -17,6 +17,7 @@ import ca.uhn.fhir.rest.param.ReferenceParam;
|
|||
import ca.uhn.fhir.rest.param.TokenAndListParam;
|
||||
import ca.uhn.fhir.rest.param.TokenOrListParam;
|
||||
import ca.uhn.fhir.rest.param.TokenParam;
|
||||
import ca.uhn.fhir.test.utilities.docker.RequiresDocker;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
@ -47,6 +48,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@RequiresDocker
|
||||
@Testcontainers
|
||||
public class LastNElasticsearchSvcSingleObservationIT {
|
||||
|
||||
|
@ -323,3 +325,4 @@ public class LastNElasticsearchSvcSingleObservationIT {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import ca.uhn.fhir.jpa.term.custom.CustomTerminologySet;
|
|||
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
|
||||
import ca.uhn.fhir.test.utilities.docker.RequiresDocker;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.r4.model.CodeSystem;
|
||||
import org.hl7.fhir.r4.model.CodeableConcept;
|
||||
|
@ -50,6 +51,7 @@ import static org.mockito.Mockito.when;
|
|||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@ContextConfiguration(classes = {TestR4ConfigWithElasticSearch.class})
|
||||
@RequiresDocker
|
||||
public class ValueSetExpansionR4ElasticsearchIT extends BaseJpaTest {
|
||||
|
||||
protected static final String CS_URL = "http://example.com/my_code_system";
|
||||
|
|
|
@ -30,14 +30,18 @@ import org.testcontainers.DockerClientFactory;
|
|||
* Execution condition which will skip test classes that require docker if it is not present on the host machine
|
||||
*/
|
||||
public class DockerRequiredCondition implements ExecutionCondition {
|
||||
public static final String AVAILABLE_MSG = "Docker is installed so we can run these tests!";
|
||||
public static final String UNAVAILABLE_MSG = "It appears as though docker is not installed on the host machine!";
|
||||
|
||||
@Override
|
||||
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext theExtensionContext) {
|
||||
try {
|
||||
DockerClientFactory.instance().isDockerAvailable();
|
||||
return ConditionEvaluationResult.enabled("Docker is installed so we can run these tests!");
|
||||
boolean isDockerAvailable = DockerClientFactory.instance().isDockerAvailable();
|
||||
return isDockerAvailable
|
||||
? ConditionEvaluationResult.enabled(AVAILABLE_MSG)
|
||||
: ConditionEvaluationResult.disabled(UNAVAILABLE_MSG);
|
||||
} catch (Exception e) {
|
||||
return ConditionEvaluationResult.disabled("It appears as though docker is not installed on the host machine!");
|
||||
return ConditionEvaluationResult.disabled(UNAVAILABLE_MSG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue