forked from apache/druid
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use quidem to run tests (apache#16249)
* test scoped jdbc driver for druidtest:/// backed DruidAvaticaTestDriver ** DecoupledTestConfig is used inside the URI - this will make it possible to attach to existing things more easily * DruidQuidemTestBase can be used to create module level set of quidem tests * added quidem commands: !convertedPlan, !logicalPlan, !druidPlan, !nativePlan ** for these I've used some values of the Hook which was there in calcite * there are some shortcuts with proxies(they are only used during testing) - we can probably remove those later
- Loading branch information
Showing
35 changed files
with
1,962 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,3 +47,4 @@ website/i18n/* | |
nbproject | ||
nbactions.xml | ||
nb-configuration.xml | ||
*.iq.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
benchmarks/src/test/resources/META-INF/services/java.sql.Driver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
org.apache.druid.quidem.DruidAvaticaTestDriver | ||
org.apache.calcite.avatica.remote.Driver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
|
||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
#-------------------------------------------------------------------- | ||
|
||
# Utility script for running the new integration tests, since the Maven | ||
# commands are unwieldy. Allows straightforward usage of ITs on the desktop | ||
# and in various build scripts. Handles configuration of various kinds. | ||
|
||
|
||
set -e | ||
|
||
OPTS+=" -Pskip-static-checks" | ||
OPTS+=" -Dsurefire.rerunFailingTestsCount=0" | ||
OPTS+=" -Dorg.slf4j.simpleLogger.log.org.apache.maven.plugin.surefire.SurefirePlugin=INFO" | ||
[[ $@ =~ "-q" ]] && OPTS+=" -Dsurefire.trimStackTrace=true" | ||
|
||
OPTS+=" -pl sql -Dtest=SqlQuidemTest" | ||
OPTS+=" org.apache.maven.plugins:maven-surefire-plugin:test" | ||
|
||
case "$1" in | ||
-h|--help) | ||
cat << EOF | ||
Run SqlQuidemTest tests. | ||
-q quiet (recommened) | ||
-Dquidem.overwrite enables overwrite mode | ||
-Dquidem.filter=*join* runs only tests matching path expression | ||
EOF | ||
exit 1 | ||
;; | ||
esac | ||
|
||
exec mvn "$@" $OPTS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
sql/src/test/java/org/apache/druid/quidem/DruidAvaticaDriverTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.apache.druid.quidem; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.sql.Connection; | ||
import java.sql.DriverManager; | ||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
import java.sql.Statement; | ||
|
||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertTrue; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class DruidAvaticaDriverTest | ||
{ | ||
// create a new driver instance; this will load the class and register it | ||
DruidAvaticaTestDriver driver = new DruidAvaticaTestDriver(); | ||
|
||
@Test | ||
public void testSelect() throws SQLException | ||
{ | ||
try (Connection con = DriverManager.getConnection("druidtest:///"); | ||
Statement stmt = con.createStatement(); | ||
ResultSet rs = stmt.executeQuery("select 42");) { | ||
assertTrue(rs.next()); | ||
assertEquals(42, rs.getInt(1)); | ||
assertFalse(rs.next()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testURIParse() throws SQLException | ||
{ | ||
DruidAvaticaTestDriver.buildConfigfromURIParams("druidtest:///"); | ||
} | ||
} |
Oops, something went wrong.