use of com.facebook.presto.resourceGroups.db.DbManagerSpecProvider in project presto by prestodb.
the class TestReloadingResourceGroupConfigurationManager method testRefreshInterval.
@Test
public void testRefreshInterval() {
H2DaoProvider daoProvider = setup("selectors");
H2ResourceGroupsDao dao = daoProvider.get();
dao.createResourceGroupsTable();
dao.createSelectorsTable();
dao.insertResourceGroup(1, "global", "100%", 100, 100, 100, null, null, null, null, null, null, null, null, null, ENVIRONMENT);
DbManagerSpecProvider dbManagerSpecProvider = new DbManagerSpecProvider(daoProvider.get(), ENVIRONMENT, new ReloadingResourceGroupConfig());
ReloadingResourceGroupConfigurationManager manager = new ReloadingResourceGroupConfigurationManager((poolId, listener) -> {
}, new ReloadingResourceGroupConfig().setMaxRefreshInterval(Duration.valueOf("1ms")), dbManagerSpecProvider);
dao.dropSelectorsTable();
manager.load();
try {
manager.getSelectors();
fail("Expected unavailable configuration exception");
} catch (Exception e) {
assertTrue(e.getMessage().startsWith("Resource group configuration cannot be fetched from source."));
}
try {
manager.getRootGroups();
fail("Expected unavailable configuration exception");
} catch (Exception e) {
assertTrue(e.getMessage().startsWith("Resource group configuration cannot be fetched from source."));
}
manager.destroy();
}
Aggregations