Skip to content

Commit 4523759

Browse files
committed
added cleanup code for gcs resources
1 parent a1a4049 commit 4523759

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

src/e2e-test/features/bigquery/sink/BigQueryToBigQueryAdditional.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ Feature: BigQuery sink - Verification of BigQuery to BigQuery successful data tr
375375
Then Verify the pipeline status is "Succeeded"
376376
Then Validate the data transferred from BigQuery to BigQuery with actual And expected file for: "bqUpsertDedupeFile"
377377

378-
@BQ_RECORD_SOURCE_TEST @BQ_SECOND_RECORD_SOURCE_TEST @BQ_SINK_TEST
378+
@BQ_PRIMARY_RECORD_SOURCE_TEST @BQ_SECONDARY_RECORD_SOURCE_TEST @BQ_SINK_TEST
379379
Scenario: Validate successful record transfer from two BigQuery source plugins with different schema record names, taking one extra column in BigQuery source plugin 1,and
380380
using wrangler transformation plugin for removing the extra column and transferring the data in BigQuery sink plugin containing all the columns from both the source plugin.
381381
Given Open Datafusion Project to configure pipeline

src/e2e-test/java/io/cdap/plugin/common/stepsdesign/TestSetupHooks.java

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ public static void createBucketWithAvroTestFile() throws IOException, URISyntaxE
202202
@After(order = 1, value = "@GCS_CSV_TEST or @GCS_TSV_TEST or @GCS_BLOB_TEST " +
203203
"or @GCS_DELIMITED_TEST or @GCS_TEXT_TEST or @GCS_OUTPUT_FIELD_TEST or @GCS_DATATYPE_1_TEST or " +
204204
"@GCS_DATATYPE_2_TEST or @GCS_READ_RECURSIVE_TEST or @GCS_DELETE_WILDCARD_TEST or @GCS_CSV_RANGE_TEST or" +
205-
" @GCS_PARQUET_TEST or @GCS_AVRO_TEST or @GCS_DATATYPE_TEST or @GCS_AVRO_FILE")
205+
" @GCS_PARQUET_TEST or @GCS_AVRO_TEST or @GCS_DATATYPE_TEST or @GCS_AVRO_FILE or @GCS_CSV or " +
206+
"GCS_MULTIPLE_FILES_TEST or GCS_MULTIPLE_FILES_REGEX_TEST")
206207
public static void deleteSourceBucketWithFile() {
207208
deleteGCSBucket(gcsSourceBucketName);
208209
PluginPropertyUtils.removePluginProp("gcsSourceBucketName");
@@ -235,7 +236,7 @@ public static void createTargetGCSBucketWithCSVFile() throws IOException, URISyn
235236
BeforeActions.scenario.write("GCS target bucket name - " + gcsTargetBucketName);
236237
}
237238

238-
@After(order = 1, value = "@GCS_SINK_TEST or @GCS_SINK_EXISTING_BUCKET_TEST")
239+
@After(order = 1, value = "@GCS_SINK_TEST or @GCS_SINK_EXISTING_BUCKET_TEST or @GCS_SINK_MULTI_PART_UPLOAD")
239240
public static void deleteTargetBucketWithFile() {
240241
deleteGCSBucket(gcsTargetBucketName);
241242
PluginPropertyUtils.removePluginProp("gcsTargetBucketName");
@@ -250,7 +251,8 @@ public static void setTempTargetBQTableName() {
250251
BeforeActions.scenario.write("BQ Target table name - " + bqTargetTable);
251252
}
252253

253-
@After(order = 1, value = "@BQ_SINK_TEST")
254+
@After(order = 1, value = "@BQ_SINK_TEST or @BQ_UPSERT_SINK_TEST or @BQ_UPDATE_SINK_DEDUPE_TEST or " +
255+
"@BQ_EXISTING_SINK_TEST or @BQ_UPSERT_DEDUPE_SINK_TEST or @BQ_INSERT_SINK_TEST")
254256
public static void deleteTempTargetBQTable() throws IOException, InterruptedException {
255257
try {
256258
BigQueryClient.dropBqQuery(bqTargetTable);
@@ -294,7 +296,9 @@ public static void createTempSourceBQTable() throws IOException, InterruptedExce
294296

295297
@After(order = 1, value = "@BQ_SOURCE_TEST or @BQ_PARTITIONED_SOURCE_TEST or @BQ_SOURCE_DATATYPE_TEST or " +
296298
"@BQ_INSERT_SOURCE_TEST or @BQ_UPDATE_SINK_TEST or @BQ_EXISTING_SOURCE_TEST or @BQ_EXISTING_SINK_TEST or " +
297-
"@BQ_EXISTING_SOURCE_DATATYPE_TEST or @BQ_EXISTING_SINK_DATATYPE_TEST")
299+
"@BQ_EXISTING_SOURCE_DATATYPE_TEST or @BQ_EXISTING_SINK_DATATYPE_TEST or @BQ_UPSERT_SOURCE_TEST or " +
300+
"@BQ_NULL_MODE_SOURCE_TEST or @BQ_UPDATE_SOURCE_DEDUPE_TEST or @BQ_INSERT_INT_SOURCE_TEST or " +
301+
"@BQ_TIME_SOURCE_TEST or @BQ_UPSERT_DEDUPE_SOURCE_TEST or @BQ_PRIMARY_RECORD_SOURCE_TEST")
298302
public static void deleteTempSourceBQTable() throws IOException, InterruptedException {
299303
BigQueryClient.dropBqQuery(bqSourceTable);
300304
PluginPropertyUtils.removePluginProp("bqSourceTable");
@@ -1251,7 +1255,7 @@ public static void createSinkBQDeupeUpsertTable() throws IOException, Interrupte
12511255
BeforeActions.scenario.write("BQ Target Table " + bqTargetTable + " created successfully");
12521256
}
12531257

1254-
@Before(order = 1, value = "@BQ_RECORD_SOURCE_TEST")
1258+
@Before(order = 1, value = "@BQ_PRIMARY_RECORD_SOURCE_TEST")
12551259
public static void createSourceBQRecordTable() throws IOException, InterruptedException {
12561260
bqSourceTable = "E2E_SOURCE_" + UUID.randomUUID().toString().replaceAll("-", "_");
12571261
io.cdap.e2e.utils.BigQueryClient.getSoleQueryResult("create table `" + datasetName + "." + bqSourceTable + "` " +
@@ -1270,7 +1274,7 @@ public static void createSourceBQRecordTable() throws IOException, InterruptedEx
12701274
BeforeActions.scenario.write("BQ Source Table " + bqSourceTable + " created successfully");
12711275
}
12721276

1273-
@Before(order = 1, value = "@BQ_SECOND_RECORD_SOURCE_TEST")
1277+
@Before(order = 1, value = "@BQ_SECONDARY_RECORD_SOURCE_TEST")
12741278
public static void createSourceBQSecondRecordTable() throws IOException, InterruptedException {
12751279
bqSourceTable2 = "E2E_SOURCE_" + UUID.randomUUID().toString().replaceAll("-", "_");
12761280
io.cdap.e2e.utils.BigQueryClient.getSoleQueryResult("create table `" + datasetName + "." + bqSourceTable2 + "` " +
@@ -1604,18 +1608,16 @@ public static void createSourceTables() throws IOException, InterruptedException
16041608
public static void deleteAllBqTables() throws IOException, InterruptedException {
16051609
BigQueryClient.dropBqQuery(bqSourceTable);
16061610
BigQueryClient.dropBqQuery(bqSourceTable2);
1607-
BigQueryClient.dropBqQuery(PluginPropertyUtils.pluginProp("bqTargetTable"));
1608-
BigQueryClient.dropBqQuery(PluginPropertyUtils.pluginProp("bqTargetTable2"));
1611+
bqTargetTable = PluginPropertyUtils.pluginProp("bqTargetTable");
1612+
bqTargetTable2 = PluginPropertyUtils.pluginProp("bqTargetTable2");
1613+
BigQueryClient.dropBqQuery(bqTargetTable);
1614+
BigQueryClient.dropBqQuery(bqTargetTable2);
16091615
PluginPropertyUtils.removePluginProp("bqSourceTable");
16101616
PluginPropertyUtils.removePluginProp("bqSourceTable2");
16111617
BeforeActions.scenario.write("BQ source Table " + bqSourceTable + " deleted successfully");
16121618
BeforeActions.scenario.write("BQ source Table2 " + bqSourceTable2 + " deleted successfully");
16131619
BeforeActions.scenario.write("BQ target Table " + bqTargetTable + " deleted successfully");
1614-
BeforeActions.scenario.write("BQ target Table2 " + bqTargetTable + " deleted successfully");
1615-
bqSourceTable = StringUtils.EMPTY;
1616-
bqSourceTable2 = StringUtils.EMPTY;
1617-
bqTargetTable = StringUtils.EMPTY;
1618-
bqTargetTable2 = StringUtils.EMPTY;
1620+
BeforeActions.scenario.write("BQ target Table2 " + bqTargetTable2 + " deleted successfully");
16191621
}
16201622

16211623
@After(order = 1, value = "@BQ_SINK_BQMT_TEST")
@@ -1636,4 +1638,12 @@ public static void deleteTargetBqmtTable() throws IOException, InterruptedExcept
16361638
}
16371639
}
16381640
}
1641+
1642+
@After(order = 1, value = "@BQ_SECONDARY_RECORD_SOURCE_TEST")
1643+
public static void deleteTempSource2BQTable() throws IOException, InterruptedException {
1644+
BigQueryClient.dropBqQuery(bqSourceTable2);
1645+
bqSourceTable2 = PluginPropertyUtils.pluginProp("bqSourceTable2");
1646+
PluginPropertyUtils.removePluginProp("bqSourceTable2");
1647+
BeforeActions.scenario.write("BQ source Table2 " + bqSourceTable2 + " deleted successfully");
1648+
}
16391649
}

0 commit comments

Comments
 (0)