use of com.bakdata.conquery.util.support.TestConquery in project conquery by bakdata.
the class IntegrationTests method readTest.
private static DynamicTest readTest(Resource resource, String name, IntegrationTests integrationTests) {
try (InputStream in = resource.open()) {
JsonIntegrationTest test = new JsonIntegrationTest(in);
ConqueryConfig conf = getConfigOverride(test, integrationTests.getWorkDir());
name = test.getTestSpec().getLabel();
TestConquery conquery = getCachedConqueryInstance(integrationTests.getWorkDir(), conf);
return DynamicTest.dynamicTest(name, URI.create("classpath:/" + resource.getPath()), new IntegrationTest.Wrapper(name, conquery, test));
} catch (Exception e) {
return DynamicTest.dynamicTest(name, resource.getURI(), () -> {
throw e;
});
}
}
use of com.bakdata.conquery.util.support.TestConquery in project conquery by bakdata.
the class IntegrationTests method getCachedConqueryInstance.
@SneakyThrows
private static synchronized TestConquery getCachedConqueryInstance(File workDir, ConqueryConfig conf) {
// This should be fast enough and a stable comparison
String confString = CONFIG_WRITER.writeValueAsString(conf);
if (!reusedInstances.containsKey(confString)) {
// For the overriden config we must override the ports so there are no clashes
// We do it here so the config "hash" is not influenced by the port settings
TestConquery.configureRandomPorts(conf);
log.trace("Creating a new test conquery instance for test {}", conf);
TestConquery conquery = new TestConquery(workDir, conf);
reusedInstances.put(confString, conquery);
conquery.beforeAll();
}
TestConquery conquery = reusedInstances.get(confString);
return conquery;
}
Aggregations