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-1308317 SNOW-1432770 Update DatabaseMetaDataInternalIT testGetTables to work with adding account_usage_snowhouse_local_setup_import.sql to make setup #1760

Merged
merged 2 commits into from
May 20, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -476,15 +476,25 @@ public void testGetTables() throws SQLException {
assertEquals(0, getSizeOfResultSet(resultSet));
}

// Get the count of tables in the SNOWFLAKE system database, so we can exclude them from
// subsequent assertions
int numSnowflakeTables = 0;
try (ResultSet snowflakeResultSet =
databaseMetaData.getTables("SNOWFLAKE", null, null, null)) {
numSnowflakeTables = getSizeOfResultSet(snowflakeResultSet);
}

try (ResultSet resultSet = databaseMetaData.getTables(null, null, null, null)) {
assertEquals(
getAllObjectCountInDBViaInforSchema(getAllTable), getSizeOfResultSet(resultSet));
getAllObjectCountInDBViaInforSchema(getAllTable),
getSizeOfResultSet(resultSet) - numSnowflakeTables);
}

try (ResultSet resultSet =
databaseMetaData.getTables(null, null, null, new String[] {"VIEW", "SYSTEM_TABLE"})) {
assertEquals(
getAllObjectCountInDBViaInforSchema(getAllView), getSizeOfResultSet(resultSet));
getAllObjectCountInDBViaInforSchema(getAllView),
getSizeOfResultSet(resultSet) - numSnowflakeTables);
}

try (ResultSet resultSet =
Expand All @@ -497,13 +507,15 @@ public void testGetTables() throws SQLException {
databaseMetaData.getTables(
null, null, null, new String[] {"TABLE", "VIEW", "SYSTEM_TABLE"})) {
assertEquals(
getAllObjectCountInDBViaInforSchema(getAllTable), getSizeOfResultSet(resultSet));
getAllObjectCountInDBViaInforSchema(getAllTable),
getSizeOfResultSet(resultSet) - numSnowflakeTables);
}

try (ResultSet resultSet =
databaseMetaData.getTables(null, null, null, new String[] {"TABLE", "VIEW"})) {
assertEquals(
getAllObjectCountInDBViaInforSchema(getAllTable), getSizeOfResultSet(resultSet));
getAllObjectCountInDBViaInforSchema(getAllTable),
getSizeOfResultSet(resultSet) - numSnowflakeTables);
}

try (ResultSet resultSet =
Expand All @@ -515,7 +527,8 @@ public void testGetTables() throws SQLException {
try (ResultSet resultSet =
databaseMetaData.getTables(null, null, null, new String[] {"VIEW"})) {
assertEquals(
getAllObjectCountInDBViaInforSchema(getAllView), getSizeOfResultSet(resultSet));
getAllObjectCountInDBViaInforSchema(getAllView),
getSizeOfResultSet(resultSet) - numSnowflakeTables);
}

try (ResultSet resultSet =
Expand Down
Loading