Skip to content
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

SNOW-1063992: Exclude JDBC perf test schemas from DatabaseMetaDataIT.testGetSchemas #1646

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/test/java/net/snowflake/client/TestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import static org.junit.Assert.assertTrue;

import java.sql.Statement;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Pattern;
import net.snowflake.client.core.SFException;
import net.snowflake.client.jdbc.SnowflakeUtil;
Expand All @@ -25,15 +27,18 @@ public class TestUtil {
public static final String GENERATED_SCHEMA_PREFIX = "GENERATED_";
public static final String ESCAPED_GENERATED_SCHEMA_PREFIX =
GENERATED_SCHEMA_PREFIX.replaceAll("_", "\\\\_");
private static final String GITHUB_SCHEMA_PREFIX =
"GITHUB_"; // created by JDBC CI jobs before tests
private static final String GITHUB_JOB_SCHEMA_PREFIX =
"GH_JOB_"; // created by other drivers e.g. Python driver

private static final List<String> schemaGeneratedInTestsPrefixes =
Arrays.asList(
GENERATED_SCHEMA_PREFIX,
"GITHUB_", // created by JDBC CI jobs before tests
"GH_JOB_", // created by other drivers tests e.g. Python
"JDBCPERF", // created in JDBC perf tests
"SCHEMA_" // created by other drivers tests e.g. Scala
);

public static boolean isSchemaGeneratedInTests(String schema) {
return schema.startsWith(TestUtil.GITHUB_SCHEMA_PREFIX)
|| schema.startsWith(TestUtil.GITHUB_JOB_SCHEMA_PREFIX)
|| schema.startsWith(TestUtil.GENERATED_SCHEMA_PREFIX);
return schemaGeneratedInTestsPrefixes.stream().anyMatch(prefix -> schema.startsWith(prefix));
}

/**
Expand Down
Loading