-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce BaseConnectorTest, merging AbstractTestDistributedQueries and AbstractTestIntegrationSmokeTest #6989
Merged
+841
−219
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e191bc1
Run distributed queries for base JDBC with H2
findepi 1da48e1
Add dedicated test for queries with caching
findepi 3d13940
Rename AbstractTestIntegrationSmokeTest to BaseConnectorTest
findepi f0327d0
Re-add AbstractTestIntegrationSmokeTest for backwards-compatibility
findepi 54143eb
Make BaseConnectorTest extend AbstractTestDistributedQueries
findepi 40752e2
Merge TestPostgreSqlDistributedQueries with TestPostgreSqlIntegration…
findepi 0feb871
Merge TestRedisDistributed with TestRedisIntegrationSmokeTest
findepi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
120 changes: 120 additions & 0 deletions
120
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/TestJdbcCachingQueries.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,120 @@ | ||
/* | ||
* Licensed 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 io.trino.plugin.jdbc; | ||
|
||
import com.google.common.collect.ImmutableMap; | ||
import io.trino.testing.AbstractTestDistributedQueries; | ||
import io.trino.testing.QueryRunner; | ||
import io.trino.testing.sql.JdbcSqlExecutor; | ||
import io.trino.testing.sql.TestTable; | ||
import io.trino.tpch.TpchTable; | ||
import org.testng.SkipException; | ||
|
||
import java.util.Map; | ||
import java.util.Optional; | ||
import java.util.Properties; | ||
|
||
import static io.trino.plugin.jdbc.H2QueryRunner.createH2QueryRunner; | ||
|
||
public class TestJdbcCachingQueries | ||
// TODO define shorter tests set that exercises various read and write scenarios (a.k.a. "a smoke test") | ||
extends AbstractTestDistributedQueries | ||
{ | ||
private Map<String, String> properties; | ||
|
||
@Override | ||
protected QueryRunner createQueryRunner() | ||
throws Exception | ||
{ | ||
properties = ImmutableMap.<String, String>builder() | ||
.putAll(TestingH2JdbcModule.createProperties()) | ||
.put("metadata.cache-ttl", "10m") | ||
.put("metadata.cache-missing", "true") | ||
.put("allow-drop-table", "true") | ||
.build(); | ||
return createH2QueryRunner(TpchTable.getTables(), properties); | ||
} | ||
|
||
@Override | ||
protected boolean supportsDelete() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
protected boolean supportsViews() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
protected boolean supportsArrays() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
protected boolean supportsCommentOnTable() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
protected boolean supportsCommentOnColumn() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
public void testLargeIn(int valuesCount) | ||
{ | ||
throw new SkipException("This test should pass with H2, but takes too long (currently over a mninute) and is not that important"); | ||
} | ||
|
||
@Override | ||
protected TestTable createTableWithDefaultColumns() | ||
{ | ||
return new TestTable( | ||
getSqlExecutor(), | ||
"tpch.table", | ||
"(col_required BIGINT NOT NULL," + | ||
"col_nullable BIGINT," + | ||
"col_default BIGINT DEFAULT 43," + | ||
"col_nonnull_default BIGINT NOT NULL DEFAULT 42," + | ||
"col_required2 BIGINT NOT NULL)"); | ||
} | ||
|
||
@Override | ||
protected Optional<DataMappingTestSetup> filterDataMappingSmokeTestData(DataMappingTestSetup dataMappingTestSetup) | ||
{ | ||
String typeBaseName = dataMappingTestSetup.getTrinoTypeName().replaceAll("\\([^()]*\\)", ""); | ||
switch (typeBaseName) { | ||
case "boolean": | ||
case "decimal": | ||
case "char": | ||
case "varbinary": | ||
case "time": | ||
case "timestamp": | ||
case "timestamp with time zone": | ||
return Optional.of(dataMappingTestSetup.asUnsupported()); | ||
} | ||
|
||
return Optional.of(dataMappingTestSetup); | ||
} | ||
|
||
private JdbcSqlExecutor getSqlExecutor() | ||
{ | ||
return new JdbcSqlExecutor(properties.get("connection-url"), new Properties()); | ||
} | ||
} |
117 changes: 117 additions & 0 deletions
117
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/TestJdbcConnectorTest.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,117 @@ | ||
/* | ||
* Licensed 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 io.trino.plugin.jdbc; | ||
|
||
import com.google.common.collect.ImmutableMap; | ||
import io.trino.testing.BaseConnectorTest; | ||
import io.trino.testing.QueryRunner; | ||
import io.trino.testing.sql.JdbcSqlExecutor; | ||
import io.trino.testing.sql.TestTable; | ||
import io.trino.tpch.TpchTable; | ||
import org.testng.SkipException; | ||
|
||
import java.util.Map; | ||
import java.util.Optional; | ||
import java.util.Properties; | ||
|
||
import static io.trino.plugin.jdbc.H2QueryRunner.createH2QueryRunner; | ||
|
||
public class TestJdbcConnectorTest | ||
extends BaseConnectorTest | ||
{ | ||
private Map<String, String> properties; | ||
|
||
@Override | ||
protected QueryRunner createQueryRunner() | ||
throws Exception | ||
{ | ||
properties = ImmutableMap.<String, String>builder() | ||
.putAll(TestingH2JdbcModule.createProperties()) | ||
.put("allow-drop-table", "true") | ||
.build(); | ||
return createH2QueryRunner(TpchTable.getTables(), properties); | ||
} | ||
|
||
@Override | ||
protected boolean supportsDelete() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
protected boolean supportsViews() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
protected boolean supportsArrays() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
protected boolean supportsCommentOnTable() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
protected boolean supportsCommentOnColumn() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
public void testLargeIn(int valuesCount) | ||
{ | ||
throw new SkipException("This test should pass with H2, but takes too long (currently over a mninute) and is not that important"); | ||
} | ||
|
||
@Override | ||
protected TestTable createTableWithDefaultColumns() | ||
{ | ||
return new TestTable( | ||
getSqlExecutor(), | ||
"tpch.table", | ||
"(col_required BIGINT NOT NULL," + | ||
"col_nullable BIGINT," + | ||
"col_default BIGINT DEFAULT 43," + | ||
"col_nonnull_default BIGINT NOT NULL DEFAULT 42," + | ||
"col_required2 BIGINT NOT NULL)"); | ||
} | ||
|
||
@Override | ||
protected Optional<DataMappingTestSetup> filterDataMappingSmokeTestData(DataMappingTestSetup dataMappingTestSetup) | ||
{ | ||
String typeBaseName = dataMappingTestSetup.getTrinoTypeName().replaceAll("\\([^()]*\\)", ""); | ||
switch (typeBaseName) { | ||
case "boolean": | ||
case "decimal": | ||
case "char": | ||
case "varbinary": | ||
case "time": | ||
case "timestamp": | ||
case "timestamp with time zone": | ||
return Optional.of(dataMappingTestSetup.asUnsupported()); | ||
} | ||
|
||
return Optional.of(dataMappingTestSetup); | ||
} | ||
|
||
private JdbcSqlExecutor getSqlExecutor() | ||
{ | ||
return new JdbcSqlExecutor(properties.get("connection-url"), new Properties()); | ||
} | ||
} |
36 changes: 0 additions & 36 deletions
36
plugin/trino-base-jdbc/src/test/java/io/trino/plugin/jdbc/TestJdbcDistributedQueries.java
This file was deleted.
Oops, something went wrong.
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
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
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
89 changes: 0 additions & 89 deletions
89
...postgresql/src/test/java/io/trino/plugin/postgresql/TestPostgreSqlDistributedQueries.java
This file was deleted.
Oops, something went wrong.
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
47 changes: 0 additions & 47 deletions
47
plugin/trino-redis/src/test/java/io/trino/plugin/redis/TestRedisIntegrationSmokeTest.java
This file was deleted.
Oops, something went wrong.
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
412 changes: 412 additions & 0 deletions
412
testing/trino-testing/src/main/java/io/trino/testing/BaseConnectorTest.java
Large diffs are not rendered by default.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: commit summary to long in
Merge TestPostgreSql...