From 25b7c2c6f827c5a391120cabd93fcd383b1ad32c Mon Sep 17 00:00:00 2001 From: ievgeniit Date: Tue, 7 Feb 2023 16:29:17 +0100 Subject: [PATCH] [18202] Destination-redshift: fixed tmp test tables removal in integration tests --- .../redshift/RedshiftInsertDestinationAcceptanceTest.java | 6 ++++++ .../RedshiftS3StagingInsertDestinationAcceptanceTest.java | 6 ++++++ .../RedshiftStagingS3DestinationAcceptanceTest.java | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/airbyte-integrations/connectors/destination-redshift/src/test-integration/java/io/airbyte/integrations/destination/redshift/RedshiftInsertDestinationAcceptanceTest.java b/airbyte-integrations/connectors/destination-redshift/src/test-integration/java/io/airbyte/integrations/destination/redshift/RedshiftInsertDestinationAcceptanceTest.java index 1861c100fc525..c455ef9e1c16a 100644 --- a/airbyte-integrations/connectors/destination-redshift/src/test-integration/java/io/airbyte/integrations/destination/redshift/RedshiftInsertDestinationAcceptanceTest.java +++ b/airbyte-integrations/connectors/destination-redshift/src/test-integration/java/io/airbyte/integrations/destination/redshift/RedshiftInsertDestinationAcceptanceTest.java @@ -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(); diff --git a/airbyte-integrations/connectors/destination-redshift/src/test-integration/java/io/airbyte/integrations/destination/redshift/RedshiftS3StagingInsertDestinationAcceptanceTest.java b/airbyte-integrations/connectors/destination-redshift/src/test-integration/java/io/airbyte/integrations/destination/redshift/RedshiftS3StagingInsertDestinationAcceptanceTest.java index 5e6360e32a01d..0244b29bf8123 100644 --- a/airbyte-integrations/connectors/destination-redshift/src/test-integration/java/io/airbyte/integrations/destination/redshift/RedshiftS3StagingInsertDestinationAcceptanceTest.java +++ b/airbyte-integrations/connectors/destination-redshift/src/test-integration/java/io/airbyte/integrations/destination/redshift/RedshiftS3StagingInsertDestinationAcceptanceTest.java @@ -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(); diff --git a/airbyte-integrations/connectors/destination-redshift/src/test-integration/java/io/airbyte/integrations/destination/redshift/RedshiftStagingS3DestinationAcceptanceTest.java b/airbyte-integrations/connectors/destination-redshift/src/test-integration/java/io/airbyte/integrations/destination/redshift/RedshiftStagingS3DestinationAcceptanceTest.java index b375e97d91c1f..46d758dcad431 100644 --- a/airbyte-integrations/connectors/destination-redshift/src/test-integration/java/io/airbyte/integrations/destination/redshift/RedshiftStagingS3DestinationAcceptanceTest.java +++ b/airbyte-integrations/connectors/destination-redshift/src/test-integration/java/io/airbyte/integrations/destination/redshift/RedshiftStagingS3DestinationAcceptanceTest.java @@ -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))); }