use of com.facebook.presto.server.testing.TestingPrestoServer in project presto by prestodb.
the class TestServerInfoResource method testGetServerStateWithRequiredResourceManagerCoordinators.
@Test(timeOut = 30_000, groups = { "createQueryRunner" })
public void testGetServerStateWithRequiredResourceManagerCoordinators() {
TestingPrestoServer server = queryRunner.getCoordinator(0);
URI uri = uriBuilderFrom(server.getBaseUrl().resolve("/v1/info/state")).build();
Request request = prepareGet().setHeader(PRESTO_USER, "user").setUri(uri).build();
NodeState state = client.execute(request, createJsonResponseHandler(jsonCodec(NodeState.class)));
assertEquals(state, NodeState.ACTIVE);
}
use of com.facebook.presto.server.testing.TestingPrestoServer in project presto by prestodb.
the class TestBrutalShutdown method queryRetryOnShutdown.
private static void queryRetryOnShutdown(Session session, DistributedQueryRunner queryRunner, ListeningExecutorService executor, int totalQueries) throws Exception {
List<ListenableFuture<?>> queryFutures = new ArrayList<>();
for (int i = 0; i < totalQueries; i++) {
queryFutures.add(executor.submit(() -> queryRunner.execute(session, "SELECT COUNT(*), clerk FROM orders GROUP BY clerk")));
}
TestingPrestoServer worker = queryRunner.getServers().stream().filter(server -> !server.isCoordinator()).findFirst().get();
TaskManager taskManager = worker.getTaskManager();
// wait until tasks show up on the worker
while (taskManager.getAllTaskInfo().isEmpty()) {
MILLISECONDS.sleep(100);
}
// kill a worker
worker.stopResponding();
for (ListenableFuture<?> future : queryFutures) {
try {
future.get();
} catch (Exception e) {
// it is ok to fail
}
}
}
Aggregations