Skip to content

Commit

Permalink
SNOW-1308317 SNOW-1432770 Update DatabaseMetaDataInternalIT testGetTa…
Browse files Browse the repository at this point in the history
…bles to work with adding account_usage_snowhouse_local_setup_import.sql to make setup (#1760)
  • Loading branch information
sfc-gh-ntrinh committed May 20, 2024
1 parent c601137 commit 23db457
Showing 1 changed file with 18 additions and 5 deletions.
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

0 comments on commit 23db457

Please sign in to comment.