Search in sources :

Example 6 with TestConquery

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;
        });
    }
}
Also used : JsonIntegrationTest(com.bakdata.conquery.integration.json.JsonIntegrationTest) TestConquery(com.bakdata.conquery.util.support.TestConquery) InputStream(java.io.InputStream) ConqueryConfig(com.bakdata.conquery.models.config.ConqueryConfig) ProgrammaticIntegrationTest(com.bakdata.conquery.integration.tests.ProgrammaticIntegrationTest) JsonIntegrationTest(com.bakdata.conquery.integration.json.JsonIntegrationTest) IOException(java.io.IOException)

Example 7 with TestConquery

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;
}
Also used : TestConquery(com.bakdata.conquery.util.support.TestConquery) SneakyThrows(lombok.SneakyThrows)

Aggregations

TestConquery (com.bakdata.conquery.util.support.TestConquery)7 JsonIntegrationTest (com.bakdata.conquery.integration.json.JsonIntegrationTest)6 Query (com.bakdata.conquery.apiv1.query.Query)5 ShardNode (com.bakdata.conquery.commands.ShardNode)5 IntegrationUtils (com.bakdata.conquery.integration.common.IntegrationUtils)5 LoadingUtil (com.bakdata.conquery.integration.common.LoadingUtil)5 LoadingUtil.importSecondaryIds (com.bakdata.conquery.integration.common.LoadingUtil.importSecondaryIds)5 QueryTest (com.bakdata.conquery.integration.json.QueryTest)5 ProgrammaticIntegrationTest (com.bakdata.conquery.integration.tests.ProgrammaticIntegrationTest)5 ModificationShieldedWorkerStorage (com.bakdata.conquery.io.storage.ModificationShieldedWorkerStorage)5 Dataset (com.bakdata.conquery.models.datasets.Dataset)5 ValidatorHelper (com.bakdata.conquery.models.exceptions.ValidatorHelper)5 ExecutionState (com.bakdata.conquery.models.execution.ExecutionState)5 Namespace (com.bakdata.conquery.models.worker.Namespace)5 Worker (com.bakdata.conquery.models.worker.Worker)5 StandaloneSupport (com.bakdata.conquery.util.support.StandaloneSupport)5 In (com.github.powerlibraries.io.In)5 Slf4j (lombok.extern.slf4j.Slf4j)5 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)5 MetaStorage (com.bakdata.conquery.io.storage.MetaStorage)4