Fix and add sys IT tests to travis script (#7208)

* Add sys IT tests to travis script

* minor fixes

* Modify the test queries

* modify query
This commit is contained in:
Surekha 2019-03-08 16:40:59 -08:00 committed by Gian Merlino
parent a44df6522c
commit 6991735f73
7 changed files with 21 additions and 14 deletions

View File

@ -21,6 +21,6 @@ set -e
pushd $TRAVIS_BUILD_DIR/integration-tests
mvn verify -P integration-tests -Dit.test=ITUnionQueryTest,ITNestedQueryPushDownTest,ITTwitterQueryTest,ITWikipediaQueryTest,ITBasicAuthConfigurationTest,ITTLSTest
mvn verify -P integration-tests -Dit.test=ITUnionQueryTest,ITNestedQueryPushDownTest,ITTwitterQueryTest,ITWikipediaQueryTest,ITBasicAuthConfigurationTest,ITTLSTest,ITSystemTableQueryTest,ITSystemTableBatchIndexTaskTest
popd

View File

@ -215,3 +215,8 @@ This will tell the test framework that the test class needs to be constructed us
2) FromFileTestQueryHelper - reads queries with expected results from file and executes them and verifies the results using ResultVerifier
Refer ITIndexerTest as an example on how to use dependency Injection
### Register new tests for Travis CI
Once you add new integration tests, don't forget to add them to `{DRUID_ROOT}/ci/travis_script_integration.sh`
or `{DRUID_ROOT}/ci/travis_script_integration_part2.sh` for Travis CI to run them.

View File

@ -144,9 +144,16 @@ public class AbstractITBatchIndexTest extends AbstractIndexerTest
String dataSource,
String indexTaskFilePath,
String queryFilePath
)
) throws IOException
{
submitTaskAndWait(indexTaskFilePath, dataSource, false);
final String fullDatasourceName = dataSource + config.getExtraDatasourceNameSuffix();
final String taskSpec = StringUtils.replace(
getTaskAsString(indexTaskFilePath),
"%%DATASOURCE%%",
fullDatasourceName
);
submitTaskAndWait(taskSpec, fullDatasourceName, false);
try {
sqlQueryHelper.testQueriesFromFile(queryFilePath, 2);
}

View File

@ -30,7 +30,7 @@ import java.io.Closeable;
public class ITSystemTableBatchIndexTaskTest extends AbstractITBatchIndexTest
{
private static final Logger LOG = new Logger(ITCompactionTaskTest.class);
private static final Logger LOG = new Logger(ITSystemTableBatchIndexTaskTest.class);
private static String INDEX_TASK = "/indexer/wikipedia_index_task.json";
private static String SYSTEM_QUERIES_RESOURCE = "/indexer/sys_segment_batch_index_queries.json";
private static String INDEX_DATASOURCE = "wikipedia_index_test";
@ -40,7 +40,7 @@ public class ITSystemTableBatchIndexTaskTest extends AbstractITBatchIndexTest
{
LOG.info("Starting batch index sys table queries");
try (
final Closeable indexCloseable = unloader(INDEX_DATASOURCE)
final Closeable indexCloseable = unloader(INDEX_DATASOURCE + config.getExtraDatasourceNameSuffix());
) {
doIndexTestSqlTest(
INDEX_DATASOURCE,

View File

@ -19,7 +19,6 @@
package org.apache.druid.tests.query;
import com.google.common.base.Throwables;
import com.google.inject.Inject;
import org.apache.druid.testing.IntegrationTestingConfig;
import org.apache.druid.testing.clients.CoordinatorResourceTestClient;
@ -65,7 +64,7 @@ public class ITSystemTableQueryTest
this.queryHelper.testQueriesFromFile(SYSTEM_QUERIES_RESOURCE, 2);
}
catch (Exception e) {
throw Throwables.propagate(e);
throw new RuntimeException(e);
}
}
}

View File

@ -1,7 +1,7 @@
[
{
"query": {
"query": "SELECT count(*) FROM sys.segments WHERE datasource='wikipedia_index_test'"
"query": "SELECT count(*) FROM sys.segments WHERE datasource LIKE 'wikipedia_index_test%'"
},
"expectedResults": [
{
@ -21,7 +21,7 @@
},
{
"query": {
"query": "SELECT status FROM sys.tasks"
"query": "SELECT status AS status FROM sys.tasks WHERE datasource LIKE 'wikipedia_index_test%' GROUP BY 1"
},
"expectedResults": [
{

View File

@ -1,17 +1,13 @@
[
{
"query": {
"query": "SELECT datasource, count(*) FROM sys.segments GROUP BY 1"
"query": "SELECT datasource, count(*) FROM sys.segments WHERE datasource='wikipedia_editstream' OR datasource='twitterstream' GROUP BY 1 "
},
"expectedResults": [
{
"datasource": "wikipedia_editstream",
"EXPR$1": 1
},
{
"datasource": "wikipedia",
"EXPR$1": 1
},
{
"datasource": "twitterstream",
"EXPR$1": 3