Skip to content

Commit 490e0a0

Browse files
committed
Fixing after hooks for GCP resources
1 parent 31e3726 commit 490e0a0

File tree

6 files changed

+19
-14
lines changed

6 files changed

+19
-14
lines changed

src/e2e-test/features/bigquery/source/BigQueryToBigQuery.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Feature: BigQuery source - Verification of BigQuery to BigQuery successful data
6464
Then Connect source as "BigQuery" and sink as "BigQuery" to establish connection
6565
Then Save the pipeline
6666
Then Preview and run the pipeline
67-
Then Wait till pipeline preview is in running state
67+
Then Wait till pipeline preview is in running state and check if any error occurs
6868
Then Open and capture pipeline preview logs
6969
Then Verify the preview run status of pipeline in the logs is "failed"
7070

src/e2e-test/features/gcs/sink/GCSSinkError.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Feature: GCS sink - Verify GCS Sink plugin error scenarios
4343
Then Open GCS sink properties
4444
Then Replace input plugin property: "project" with value: "projectId"
4545
Then Enter input plugin property: "referenceName" with value: "gcsReferenceName"
46-
Then Enter GCS source property path "gcsInvalidBucketName"
46+
Then Enter input plugin property: "path" with value: "gcsInvalidBucketName"
4747
Then Select GCS property format "csv"
4848
Then Click on the Validate button
4949
Then Verify that the Plugin Property: "path" is displaying an in-line error message: "errorMessageInvalidBucketName"

src/e2e-test/features/gcsmove/GCSMoveErrorScenarios.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Feature: GCSMove - Validate GCSMove plugin error scenarios
1919
When Expand Plugin group in the LHS plugins list: "Conditions and Actions"
2020
When Select plugin: "GCS Move" from the plugins list as: "Conditions and Actions"
2121
When Navigate to the properties page of plugin: "GCS Move"
22-
Then Enter GCSMove property source path "gcsInvalidBucketName"
22+
Then Enter input plugin property: "sourcePath" with value: "gcsInvalidBucketName"
2323
Then Enter GCSMove property destination path
2424
Then Verify GCS Move property "sourcePath" invalid bucket name error message is displayed for bucket "gcsInvalidBucketName"
2525

@@ -30,5 +30,5 @@ Feature: GCSMove - Validate GCSMove plugin error scenarios
3030
When Select plugin: "GCS Move" from the plugins list as: "Conditions and Actions"
3131
When Navigate to the properties page of plugin: "GCS Move"
3232
Then Enter GCSMove property source path "gcsCsvFile"
33-
Then Enter GCSMove property destination path "gcsInvalidBucketName"
33+
Then Enter input plugin property: "destPath" with value: "gcsInvalidBucketName"
3434
Then Verify GCS Move property "destPath" invalid bucket name error message is displayed for bucket "gcsInvalidBucketName"

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,13 @@ public static void createBucketWithAvroTestFile() throws IOException, URISyntaxE
208208

209209
@After(order = 1, value = "@GCS_CSV_TEST or @GCS_TSV_TEST or @GCS_BLOB_TEST " +
210210
"or @GCS_DELIMITED_TEST or @GCS_TEXT_TEST or @GCS_OUTPUT_FIELD_TEST or @GCS_DATATYPE_1_TEST or " +
211-
"@GCS_DATATYPE_2_TEST or @GCS_READ_RECURSIVE_TEST or @GCS_DELETE_WILDCARD_TEST or @GCS_CSV_RANGE_TEST or" +
212-
" @GCS_PARQUET_TEST or @GCS_AVRO_TEST or @GCS_DATATYPE_TEST or @GCS_AVRO_FILE or @GCS_CSV or " +
213-
"GCS_MULTIPLE_FILES_TEST or GCS_MULTIPLE_FILES_REGEX_TEST or @GCS_JSON_TEST")
211+
"@GCS_DATATYPE_2_TEST or @GCS_READ_RECURSIVE_TEST or @GCS_DELETE_WILDCARD_TEST or @GCS_CSV_RANGE_TEST or " +
212+
"@GCS_PARQUET_TEST or @GCS_AVRO_TEST or @GCS_DATATYPE_TEST or @GCS_AVRO_FILE or @GCS_CSV or " +
213+
"@GCS_JSON_TEST")
214214
public static void deleteSourceBucketWithFile() {
215215
deleteGCSBucket(gcsSourceBucketName);
216216
PluginPropertyUtils.removePluginProp("gcsSourceBucketName");
217217
PluginPropertyUtils.removePluginProp("gcsSourcePath");
218-
gcsSourceBucketName = StringUtils.EMPTY;
219218
}
220219

221220
@After(order = 1, value = "@GCS_DELETE_MULTIPLE_BUCKETS_TEST")
@@ -430,7 +429,7 @@ private static void createSourceBQViewWithQueries(String bqCreateViewQueryFile)
430429
}
431430

432431
private static String createGCSBucketWithFile(String filePath) throws IOException, URISyntaxException {
433-
String bucketName = StorageClient.createBucket("00000000-e2e-" + UUID.randomUUID()).getName();
432+
String bucketName = StorageClient.createBucket("cdf-e2e-test-" + UUID.randomUUID()).getName();
434433
StorageClient.uploadObject(bucketName, filePath, filePath);
435434
PluginPropertyUtils.addPluginProp("gcsSourceBucketName", bucketName);
436435
PluginPropertyUtils.addPluginProp("gcsSourcePath", "gs://" + bucketName + "/" + filePath);
@@ -972,12 +971,18 @@ public static void createBucketWithMultipleTestFiles() throws IOException, URISy
972971
gcsSourceBucketName = createGCSBucketWithMultipleFiles(PluginPropertyUtils.pluginProp("gcsMultipleFilesPath"));
973972
}
974973

974+
@After(order = 1, value = "@GCS_MULTIPLE_FILES_TEST or @GCS_MULTIPLE_FILES_REGEX_TEST")
975+
public static void deleteSourceBucketWithMultipleFile() {
976+
deleteGCSBucket(gcsSourceBucketName);
977+
PluginPropertyUtils.removePluginProp("gcsSourceBucketName");
978+
PluginPropertyUtils.removePluginProp("gcsSourcePath");
979+
}
980+
975981
@Before(order = 1, value = "@GCS_MULTIPLE_FILES_REGEX_TEST")
976982
public static void createBucketWithMultipleTestFilesWithRegex () throws IOException, URISyntaxException {
977983
gcsSourceBucketName = createGCSBucketWithMultipleFiles(PluginPropertyUtils.pluginProp(
978984
"gcsMultipleFilesFilterRegexPath"));
979-
PluginPropertyUtils.addPluginProp(" bqTargetTable", bqTargetTable);
980-
BeforeActions.scenario.write("BQ Target Table " + bqTargetTable + " updated successfully");
985+
PluginPropertyUtils.addPluginProp(" gcsSourceBucketName", gcsSourceBucketName);
981986
}
982987

983988
@Before(order = 1, value = "@BQ_EXISTING_SOURCE_TEST")
@@ -1322,7 +1327,7 @@ public static void createSinkBQInsertTable() throws IOException, InterruptedExce
13221327
BeforeActions.scenario.write("BQ Target Table " + bqTargetTable + " updated successfully");
13231328
}
13241329
private static String createGCSBucketLifeCycle() throws IOException, URISyntaxException {
1325-
String bucketName = StorageClient.createBucketwithLifeCycle("00000000-e2e-" + UUID.randomUUID(), 30).getName();
1330+
String bucketName = StorageClient.createBucketwithLifeCycle("cdf-e2e-test-" + UUID.randomUUID(), 30).getName();
13261331
PluginPropertyUtils.addPluginProp("gcsTargetBucketName", bucketName);
13271332
return bucketName;
13281333
}

src/e2e-test/java/io/cdap/plugin/gcsmove/stepsdesign/GCSMove.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public void verifyGCSMovePropertyInvalidBucketNameErrorMessageIsDisplayedForBuck
109109
String bucketName) {
110110
CdfStudioActions.clickValidateButton();
111111
String expectedErrorMessage = PluginPropertyUtils.errorProp(E2ETestConstants.ERROR_MSG_GCS_INVALID_BUCKET_NAME)
112-
.replace("BUCKET_NAME", "/" + PluginPropertyUtils.pluginProp(bucketName));
112+
.replace("BUCKET_NAME", PluginPropertyUtils.pluginProp(bucketName));
113113
String actualErrorMessage = PluginPropertyUtils.findPropertyErrorElement(property).getText();
114114
Assert.assertEquals(expectedErrorMessage, actualErrorMessage);
115115
}

src/e2e-test/resources/errorMessage.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ errorMessageIncorrectBQBucketName=Bucket name 'VALUE' can only contain lowercase
1818
errorMessageIncorrectBQTableName=Table name 'VALUE' can only contain letters (lower or uppercase), numbers, '_' and '-'.
1919
errorMessageIncorrectBQProperty=PROPERTY name 'VALUE' can only contain letters (lower or uppercase), numbers and '_'.
2020
errorMessageIncorrectDatasetName=Dataset name 'VALUE' can only contain letters (lower or uppercase), numbers and '_'.
21-
errorMessageInvalidPath=Error when trying to detect schema: Input path not found
21+
errorMessageInvalidPath=Error when trying to detect schema, java.io.IOException: Input path not found
2222
errorMessageBQExecuteTableDataset=Dataset and table must be specified together.
2323
errorMessageIncorrectMinimumSplitSize=Unable to create config for batchsource GCSFile 'minSplitSize' is invalid: Value of field class io.cdap.plugin.gcp.gcs.source.GCSSource$GCSSourceConfig.minSplitSize is expected to be a number.
2424
errorMessageIncorrectMaximumSplitSize=Unable to create config for batchsource GCSFile 'maxSplitSize' is invalid: Value of field class io.cdap.plugin.format.plugin.AbstractFileSourceConfig.maxSplitSize is expected to be a number.

0 commit comments

Comments
 (0)