Skip to content

Commit

Permalink
Introduce class hierarchy in BigQuery CaseInsensitiveMapping tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pajaks authored and ebyhr committed Oct 8, 2024
1 parent 0a4ed0d commit 0680930
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 17 deletions.
4 changes: 2 additions & 2 deletions plugin/trino-bigquery/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@
<exclude>**/TestBigQueryMetadata.java</exclude>
<exclude>**/TestBigQuerySplitManager.java</exclude>
<exclude>**/TestBigQueryInstanceCleaner.java</exclude>
<exclude>**/TestBigQueryCaseInsensitiveMapping.java</exclude>
<exclude>**/TestBigQueryCaseInsensitiveMappingWithCache.java</exclude>
<exclude>**/TestBigQuery*FailureRecoveryTest.java</exclude>
<exclude>**/TestBigQueryWithProxyTest.java</exclude>
<exclude>**/TestBigQueryParentProjectId.java</exclude>
Expand Down Expand Up @@ -579,7 +579,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/TestBigQueryCaseInsensitiveMapping.java</include>
<include>**/TestBigQueryCaseInsensitiveMappingWithCache.java</include>
<!-- Also included here to make sure the case-insesitive project also gets cleaned up -->
<include>**/TestBigQueryInstanceCleaner.java</include>
</includes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
*/
package io.trino.plugin.bigquery;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import io.trino.plugin.bigquery.BigQueryQueryRunner.BigQuerySqlExecutor;
import io.trino.testing.AbstractTestQueryFramework;
import io.trino.testing.QueryRunner;
import io.trino.testing.sql.TestTable;
import io.trino.testing.sql.TestView;
import org.junit.jupiter.api.Test;
Expand All @@ -32,24 +30,12 @@

// With case-insensitive-name-matching enabled colliding schema/table names are considered as errors.
// Some tests here create colliding names which can cause any other concurrent test to fail.
public class TestBigQueryCaseInsensitiveMapping
public abstract class BaseBigQueryCaseInsensitiveMapping
// TODO extends BaseCaseInsensitiveMappingTest - https://github.com/trinodb/trino/issues/7864
extends AbstractTestQueryFramework
{
private final BigQuerySqlExecutor bigQuerySqlExecutor = new BigQuerySqlExecutor();

@Override
protected QueryRunner createQueryRunner()
throws Exception
{
return BigQueryQueryRunner.builder()
.setConnectorProperties(ImmutableMap.<String, String>builder()
.put("bigquery.case-insensitive-name-matching", "true")
.put("bigquery.case-insensitive-name-matching.cache-ttl", "1m")
.buildOrThrow())
.build();
}

@Test
public void testNonLowerCaseSchemaName()
throws Exception
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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.bigquery;

import com.google.common.collect.ImmutableMap;
import io.trino.testing.QueryRunner;

final class TestBigQueryCaseInsensitiveMappingWithCache
extends BaseBigQueryCaseInsensitiveMapping
{
@Override
protected QueryRunner createQueryRunner()
throws Exception
{
return BigQueryQueryRunner.builder()
.setConnectorProperties(ImmutableMap.<String, String>builder()
.put("bigquery.case-insensitive-name-matching", "true")
.put("bigquery.case-insensitive-name-matching.cache-ttl", "1m")
.buildOrThrow())
.build();
}
}

0 comments on commit 0680930

Please sign in to comment.