Search in sources :

Example 11 with ClusterFixtureBuilder

use of org.apache.drill.test.ClusterFixtureBuilder in project drill by axbaretto.

the class TestConfigLinkage method testScope.

/* Test if the scope is set during BOOT time and scope is actually BOOT */
@Test
public void testScope() throws Exception {
    ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher).setOptionDefault(ExecConstants.SLICE_TARGET, 100000);
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture()) {
        String scope = client.queryBuilder().sql("SELECT optionScope from sys.%s where name='planner.slice_target'", SystemTable.OPTION_VAL.getTableName()).singletonString();
        Assert.assertEquals("BOOT", scope);
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) ClientFixture(org.apache.drill.test.ClientFixture) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) Test(org.junit.Test) OptionsTest(org.apache.drill.categories.OptionsTest) SlowTest(org.apache.drill.categories.SlowTest)

Example 12 with ClusterFixtureBuilder

use of org.apache.drill.test.ClusterFixtureBuilder in project drill by axbaretto.

the class TestConfigLinkage method testAlterInternalSystemOption.

@Test
public void testAlterInternalSystemOption() throws Exception {
    OptionDefinition optionDefinition = createMockPropOptionDefinition();
    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).configProperty(ExecConstants.bootDefaultFor(MOCK_PROPERTY), "a").putDefinition(optionDefinition);
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture()) {
        client.queryBuilder().sql("ALTER SYSTEM SET `%s` = 'bleh'", MOCK_PROPERTY).run();
        client.queryBuilder().sql("SELECT * FROM sys.%s", SystemTable.INTERNAL_OPTIONS.getTableName()).printCsv();
        client.queryBuilder().sql("SELECT * FROM sys.%s", SystemTable.INTERNAL_OPTIONS_VAL.getTableName()).printCsv();
        String mockProp = client.queryBuilder().sql("SELECT string_val FROM sys.%s where name='%s'", SystemTable.INTERNAL_OPTIONS, MOCK_PROPERTY).singletonString();
        String mockProp2 = client.queryBuilder().sql("SELECT val FROM sys.%s where name='%s'", SystemTable.INTERNAL_OPTIONS_VAL, MOCK_PROPERTY).singletonString();
        assertEquals("bleh", mockProp);
        assertEquals("bleh", mockProp2);
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) ClientFixture(org.apache.drill.test.ClientFixture) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) Test(org.junit.Test) OptionsTest(org.apache.drill.categories.OptionsTest) SlowTest(org.apache.drill.categories.SlowTest)

Example 13 with ClusterFixtureBuilder

use of org.apache.drill.test.ClusterFixtureBuilder in project drill by axbaretto.

the class TestConfigLinkage method testMaxWidthPerNodeSystem.

/* Test if setting maxwidth at system level takes precedence */
@Test
public void testMaxWidthPerNodeSystem() throws Exception {
    ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher).systemOption(ExecConstants.MAX_WIDTH_PER_NODE_KEY, 3);
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture()) {
        String maxWidth = client.queryBuilder().sql("SELECT val FROM sys.%s where name='planner.width.max_per_node' and optionScope = 'SYSTEM'", SystemTable.OPTION_VAL.getTableName()).singletonString();
        assertEquals("3", maxWidth);
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) ClientFixture(org.apache.drill.test.ClientFixture) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) Test(org.junit.Test) OptionsTest(org.apache.drill.categories.OptionsTest) SlowTest(org.apache.drill.categories.SlowTest)

Example 14 with ClusterFixtureBuilder

use of org.apache.drill.test.ClusterFixtureBuilder in project drill by axbaretto.

the class TestConfigLinkage method testMaxWidthPerNodeConfig.

/* Test if setting maxwidth option through config takes effect */
@Test
public void testMaxWidthPerNodeConfig() throws Exception {
    ClusterFixtureBuilder builder = ClusterFixture.bareBuilder(dirTestWatcher).setOptionDefault(ExecConstants.MAX_WIDTH_PER_NODE_KEY, 2);
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture()) {
        String maxWidth = client.queryBuilder().sql("SELECT val FROM sys.%s where name='planner.width.max_per_node' and optionScope = 'BOOT'", SystemTable.OPTION_VAL.getTableName()).singletonString();
        assertEquals("2", maxWidth);
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) ClientFixture(org.apache.drill.test.ClientFixture) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) Test(org.junit.Test) OptionsTest(org.apache.drill.categories.OptionsTest) SlowTest(org.apache.drill.categories.SlowTest)

Example 15 with ClusterFixtureBuilder

use of org.apache.drill.test.ClusterFixtureBuilder in project drill by axbaretto.

the class StatusResourcesTest method testRetrieveInternalOption.

@Test
public void testRetrieveInternalOption() throws Exception {
    OptionDefinition optionDefinition = createMockPropOptionDefinition();
    ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher).configProperty(ExecConstants.HTTP_ENABLE, true).configProperty(ExecConstants.bootDefaultFor(MOCK_PROPERTY), "a").configProperty(ExecConstants.HTTP_PORT_HUNT, true).configProperty(ExecConstants.SYS_STORE_PROVIDER_LOCAL_ENABLE_WRITE, false).putDefinition(optionDefinition);
    try (ClusterFixture cluster = builder.build();
        ClientFixture client = cluster.clientFixture();
        RestClientFixture restClientFixture = cluster.restClientFixture()) {
        Assert.assertNull(restClientFixture.getStatusOption(MOCK_PROPERTY));
        StatusResources.OptionWrapper option = restClientFixture.getStatusInternalOption(MOCK_PROPERTY);
        Assert.assertEquals("a", option.getValueAsString());
        client.alterSystem(MOCK_PROPERTY, "c");
        Assert.assertNull(restClientFixture.getStatusOption(MOCK_PROPERTY));
        option = restClientFixture.getStatusInternalOption(MOCK_PROPERTY);
        Assert.assertEquals("c", option.getValueAsString());
    }
}
Also used : ClusterFixture(org.apache.drill.test.ClusterFixture) RestClientFixture(org.apache.drill.test.RestClientFixture) RestClientFixture(org.apache.drill.test.RestClientFixture) ClientFixture(org.apache.drill.test.ClientFixture) ClusterFixtureBuilder(org.apache.drill.test.ClusterFixtureBuilder) OptionDefinition(org.apache.drill.exec.server.options.OptionDefinition) TestConfigLinkage.createMockPropOptionDefinition(org.apache.drill.exec.server.options.TestConfigLinkage.createMockPropOptionDefinition) Test(org.junit.Test)

Aggregations

ClusterFixtureBuilder (org.apache.drill.test.ClusterFixtureBuilder)156 ClusterFixture (org.apache.drill.test.ClusterFixture)102 Test (org.junit.Test)93 ClientFixture (org.apache.drill.test.ClientFixture)89 BeforeClass (org.junit.BeforeClass)47 SlowTest (org.apache.drill.categories.SlowTest)44 OptionsTest (org.apache.drill.categories.OptionsTest)34 BaseTest (org.apache.drill.test.BaseTest)27 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)15 DrillTest (org.apache.drill.test.DrillTest)14 OperatorTest (org.apache.drill.categories.OperatorTest)8 QueryDataBatch (org.apache.drill.exec.rpc.user.QueryDataBatch)8 FileSystemConfig (org.apache.drill.exec.store.dfs.FileSystemConfig)6 StoragePluginConfig (org.apache.drill.common.logical.StoragePluginConfig)5 PluginException (org.apache.drill.exec.store.StoragePluginRegistry.PluginException)5 File (java.io.File)4 ResourceManagerTest (org.apache.drill.categories.ResourceManagerTest)4 DefaultResourceManager (org.apache.drill.exec.work.foreman.rm.DefaultResourceManager)4 DistributedResourceManager (org.apache.drill.exec.work.foreman.rm.DistributedResourceManager)4 ResourceManager (org.apache.drill.exec.work.foreman.rm.ResourceManager)4