Skip to content

Commit

Permalink
[18202] Destination-redshift: fixed tmp test tables removal in integr…
Browse files Browse the repository at this point in the history
…ation tests (#22495)
  • Loading branch information
etsybaev authored Feb 7, 2023
1 parent 6f0c0be commit 3d2a995
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ void setup() {
.withDestinationSyncMode(DestinationSyncMode.APPEND)));
}

@Override
protected void tearDown(final TestDestinationEnv testEnv) throws Exception {
getDatabase().query(ctx -> ctx.execute(String.format("DROP SCHEMA IF EXISTS %s CASCADE", DATASET_ID)));
super.tearDown(testEnv);
}

@Test
void testIfSuperTmpTableWasCreatedAfterVarcharTmpTable() throws Exception {
setup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ void setup() {
.withDestinationSyncMode(DestinationSyncMode.APPEND)));
}

@Override
protected void tearDown(final TestDestinationEnv testEnv) throws Exception {
getDatabase().query(ctx -> ctx.execute(String.format("DROP SCHEMA IF EXISTS %s CASCADE", DATASET_ID)));
super.tearDown(testEnv);
}

@Test
void testIfSuperTmpTableWasCreatedAfterVarcharTmpTableDuringS3Staging() throws Exception {
setup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ protected void setup(final TestDestinationEnv testEnv) throws Exception {

@Override
protected void tearDown(final TestDestinationEnv testEnv) throws Exception {
final String dropSchemaQuery = String.format("DROP SCHEMA IF EXISTS %s CASCADE", config.get("schema").asText());
getDatabase().query(ctx -> ctx.execute(String.format("DROP SCHEMA IF EXISTS %s CASCADE", config.get("schema").asText())));
getDatabase().query(ctx -> ctx.execute(String.format("drop user if exists %s;", USER_WITHOUT_CREDS)));
}

Expand Down

0 comments on commit 3d2a995

Please sign in to comment.