use of io.prestosql.tests.DistributedQueryRunner in project hetu-core by openlookeng.
the class TestMemoryWorkerCrash method closeWorker.
private void closeWorker() throws Exception {
int nodeCount = getNodeCount();
DistributedQueryRunner queryRunner = (DistributedQueryRunner) getQueryRunner();
TestingPrestoServer worker = queryRunner.getServers().stream().filter(server -> !server.isCoordinator()).findAny().orElseThrow(() -> new IllegalStateException("No worker nodes"));
worker.close();
waitForNodes(nodeCount - 1);
}
use of io.prestosql.tests.DistributedQueryRunner in project hetu-core by openlookeng.
the class TestMemoryWorkerCrash method waitForNodes.
private void waitForNodes(int numberOfNodes) throws InterruptedException {
DistributedQueryRunner queryRunner = (DistributedQueryRunner) getQueryRunner();
long start = System.nanoTime();
while (queryRunner.getCoordinator().refreshNodes().getActiveNodes().size() < numberOfNodes) {
assertLessThan(nanosSince(start), new Duration(10, SECONDS));
MILLISECONDS.sleep(10);
}
}
use of io.prestosql.tests.DistributedQueryRunner in project hetu-core by openlookeng.
the class MemoryQueryRunner method main.
public static void main(String[] args) throws Exception {
Logging.initialize();
DistributedQueryRunner queryRunner = createQueryRunner(2, ImmutableMap.of(), ImmutableMap.of("http-server.http.port", "8080"), true);
Thread.sleep(10);
Logger log = Logger.get(MemoryQueryRunner.class);
log.info("======== SERVER STARTED ========");
log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
use of io.prestosql.tests.DistributedQueryRunner in project hetu-core by openlookeng.
the class TestDataCenterHTTPClientV1 method createQueryRunner.
public static DistributedQueryRunner createQueryRunner(Session session) throws Exception {
DistributedQueryRunner distributedQueryRunner = DistributedQueryRunner.builder(session).setNodeCount(2).build();
try {
distributedQueryRunner.installPlugin(new TpchPlugin());
distributedQueryRunner.createCatalog("tpch", "tpch");
return distributedQueryRunner;
} catch (Exception e) {
distributedQueryRunner.close();
throw e;
}
}
use of io.prestosql.tests.DistributedQueryRunner in project hetu-core by openlookeng.
the class TestEnvironments method testEnvironment2.
@Test(timeOut = 240_000)
public void testEnvironment2() throws Exception {
String dbConfigUrl = getDbConfigUrl();
H2ResourceGroupsDao dao = getDao(dbConfigUrl);
try (DistributedQueryRunner runner = createQueryRunner(dbConfigUrl, dao, TEST_ENVIRONMENT_2)) {
QueryId firstQuery = createQuery(runner, adhocSession(), LONG_LASTING_QUERY);
waitForQueryState(runner, firstQuery, RUNNING);
QueryId secondQuery = createQuery(runner, adhocSession(), LONG_LASTING_QUERY);
// there is no queueing in TEST_ENVIRONMENT_2, so the second query should fail right away
waitForQueryState(runner, secondQuery, FAILED);
}
}
Aggregations