Search in sources :

Example 11 with TestingNodeManager

use of io.trino.testing.TestingNodeManager in project trino by trinodb.

the class TestRaptorSplitManager method testAssignRandomNodeWhenBackupAvailable.

@Test
public void testAssignRandomNodeWhenBackupAvailable() throws URISyntaxException {
    TestingNodeManager nodeManager = new TestingNodeManager();
    CatalogName connectorId = new CatalogName("raptor");
    NodeSupplier nodeSupplier = nodeManager::getWorkerNodes;
    InternalNode node = new InternalNode(UUID.randomUUID().toString(), new URI("http://127.0.0.1/"), NodeVersion.UNKNOWN, false);
    nodeManager.addNode(node);
    RaptorSplitManager raptorSplitManagerWithBackup = new RaptorSplitManager(connectorId, nodeSupplier, shardManager, true);
    deleteShardNodes();
    ConnectorSplitSource partitionSplit = getSplits(raptorSplitManagerWithBackup, tableHandle);
    List<ConnectorSplit> batch = getSplits(partitionSplit, 1);
    assertEquals(getOnlyElement(getOnlyElement(batch).getAddresses()), node.getHostAndPort());
}
Also used : TestingNodeManager(io.trino.testing.TestingNodeManager) CatalogName(io.trino.plugin.base.CatalogName) InternalNode(io.trino.metadata.InternalNode) ConnectorSplitSource(io.trino.spi.connector.ConnectorSplitSource) URI(java.net.URI) ConnectorSplit(io.trino.spi.connector.ConnectorSplit) NodeSupplier(io.trino.plugin.raptor.legacy.NodeSupplier) RaptorSplitManager(io.trino.plugin.raptor.legacy.RaptorSplitManager) Test(org.testng.annotations.Test)

Example 12 with TestingNodeManager

use of io.trino.testing.TestingNodeManager in project trino by trinodb.

the class TestBucketBalancer method setup.

@BeforeMethod
public void setup() {
    dbi = createTestingJdbi();
    dummyHandle = dbi.open();
    createTablesWithRetry(dbi);
    metadataDao = dbi.onDemand(MetadataDao.class);
    nodeManager = new TestingNodeManager(AVAILABLE_WORKERS.stream().map(TestBucketBalancer::createTestingNode).collect(Collectors.toList()));
    NodeSupplier nodeSupplier = nodeManager::getWorkerNodes;
    shardManager = createShardManager(dbi, nodeSupplier);
    balancer = new BucketBalancer(nodeSupplier, shardManager, true, new Duration(1, DAYS), true, true, "test");
}
Also used : TestingNodeManager(io.trino.testing.TestingNodeManager) Duration(io.airlift.units.Duration) NodeSupplier(io.trino.plugin.raptor.legacy.NodeSupplier) MetadataDao(io.trino.plugin.raptor.legacy.metadata.MetadataDao) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 13 with TestingNodeManager

use of io.trino.testing.TestingNodeManager in project trino by trinodb.

the class TestHttpBackupStore method setup.

@BeforeMethod
public void setup() throws IOException {
    temporary = createTempDirectory(null);
    Map<String, String> properties = ImmutableMap.<String, String>builder().put("backup.http.uri", "http://localhost:8080").buildOrThrow();
    Bootstrap app = new Bootstrap(new TestingNodeModule(), new TestingHttpServerModule(), new JsonModule(), new JaxrsModule(), binder -> jaxrsBinder(binder).bind(TestingHttpBackupResource.class), binder -> binder.bind(NodeManager.class).toInstance(new TestingNodeManager()), override(new HttpBackupModule()).with(new TestingModule()));
    Injector injector = app.setRequiredConfigurationProperties(properties).doNotInitializeLogging().quiet().initialize();
    lifeCycleManager = injector.getInstance(LifeCycleManager.class);
    store = injector.getInstance(BackupStore.class);
}
Also used : TestingHttpServerModule(io.airlift.http.server.testing.TestingHttpServerModule) TestingNodeModule(io.airlift.node.testing.TestingNodeModule) JaxrsModule(io.airlift.jaxrs.JaxrsModule) JsonModule(io.airlift.json.JsonModule) LifeCycleManager(io.airlift.bootstrap.LifeCycleManager) TestingNodeManager(io.trino.testing.TestingNodeManager) Injector(com.google.inject.Injector) Bootstrap(io.airlift.bootstrap.Bootstrap) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

TestingNodeManager (io.trino.testing.TestingNodeManager)13 CatalogName (io.trino.plugin.base.CatalogName)7 BeforeMethod (org.testng.annotations.BeforeMethod)6 InternalNode (io.trino.metadata.InternalNode)5 Duration (io.airlift.units.Duration)4 ImmutableSet (com.google.common.collect.ImmutableSet)3 NoHdfsAuthentication (io.trino.plugin.hive.authentication.NoHdfsAuthentication)3 NodeSupplier (io.trino.plugin.raptor.legacy.NodeSupplier)3 Test (org.testng.annotations.Test)3 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)2 MoreFiles.deleteRecursively (com.google.common.io.MoreFiles.deleteRecursively)2 ALLOW_INSECURE (com.google.common.io.RecursiveDeleteOption.ALLOW_INSECURE)2 LifeCycleManager (io.airlift.bootstrap.LifeCycleManager)2 Assertions.assertGreaterThan (io.airlift.testing.Assertions.assertGreaterThan)2 Assertions.assertInstanceOf (io.airlift.testing.Assertions.assertInstanceOf)2 DataSize (io.airlift.units.DataSize)2 GroupByHashPageIndexerFactory (io.trino.operator.GroupByHashPageIndexerFactory)2 HdfsConfigurationInitializer (io.trino.plugin.hive.HdfsConfigurationInitializer)2 HdfsContext (io.trino.plugin.hive.HdfsEnvironment.HdfsContext)2