From b431b60818ab72656cf1c081d6d10e6dba8b7abe Mon Sep 17 00:00:00 2001 From: suryakumari Date: Thu, 9 Nov 2023 22:18:22 +0530 Subject: [PATCH] amazon s3 e2e test for incorrect credential validation --- .github/workflows/build.yml | 2 +- pom.xml | 40 ++++++++++++--- .../features/DesignTimeValidation.feature | 49 +++++++++++++++++++ .../resources/errorMessage.properties | 1 + .../resources/pluginParameters.properties | 4 ++ 5 files changed, 87 insertions(+), 9 deletions(-) create mode 100644 src/e2e-test/features/DesignTimeValidation.feature diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 36490c9..e4a07f7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,4 +57,4 @@ jobs: with: # GITHUB_TOKEN github_token: ${{ secrets.GITHUB_TOKEN }} - commit: ${{ github.event.workflow_run.head_branch }} + commit: ${{ github.event.workflow_run.head_sha }} diff --git a/pom.xml b/pom.xml index e42b0fb..fa93365 100644 --- a/pom.xml +++ b/pom.xml @@ -84,6 +84,7 @@ 1.1.3 4.5.14 ${project.basedir} + ${project.basedir}/src/test/java/ @@ -284,7 +285,7 @@ - src/test/java + ${testSourceLocation} @@ -408,6 +409,7 @@ e2e-tests src/e2e-test/java + TestRunner.java @@ -444,6 +446,7 @@ integration-test + verify @@ -501,23 +504,44 @@ + + + + + com.google.guava + guava + 31.1-jre + + + org.slf4j + slf4j-api + 2.0.7 + + + + + + com.google.guava + guava + + + + io.netty + netty-all + 4.1.100.Final + test + io.cdap.tests.e2e cdap-e2e-framework - 0.2.0-SNAPSHOT + 0.4.0-SNAPSHOT test ch.qos.logback logback-classic 1.2.8 - runtime - - - com.google.guava - guava - 27.0.1-jre test diff --git a/src/e2e-test/features/DesignTimeValidation.feature b/src/e2e-test/features/DesignTimeValidation.feature new file mode 100644 index 0000000..23de989 --- /dev/null +++ b/src/e2e-test/features/DesignTimeValidation.feature @@ -0,0 +1,49 @@ +# +# Copyright © 2023 Cask Data, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# + +@S3 +Feature: S3 source - Design Time validation for S3 source + + Scenario:Validate error message providing incorrect credentials when verify credentials is true + Given Open Datafusion Project to configure pipeline + When Select plugin: "Amazon S3" from the plugins list as: "Source" + Then Navigate to the properties page of plugin: "Amazon S3" + Then Enter input plugin property: "accessID" with value: "invalidAccessID" + Then Enter input plugin property: "accessKey" with value: "invalidAccessKey" + Then Enter input plugin property: "sessionToken" with value: "invalidSessionToken" + Then Enter input plugin property: "referenceName" with value: "s3Source" + Then Enter input plugin property: "path" with value: "testSourcePath" + Then Select dropdown plugin property: "format" with option value: "csv" + Then Select radio button plugin property: "verifyCredentials" with value: "true" + Then Click plugin property: "skipHeader" + Then Click plugin property: "enableQuotedValues" + Then Click on the Validate button + Then Verify that the Plugin is displaying an error message: "errorMessageInvalidCredentials" on the header + + Scenario:Validate 'No errors found' message is displayed on providing incorrect credentials when verify credentials is false + Given Open Datafusion Project to configure pipeline + When Select plugin: "Amazon S3" from the plugins list as: "Source" + Then Navigate to the properties page of plugin: "Amazon S3" + Then Enter input plugin property: "accessID" with value: "invalidAccessID" + Then Enter input plugin property: "accessKey" with value: "invalidAccessKey" + Then Enter input plugin property: "sessionToken" with value: "invalidSessionToken" + Then Enter input plugin property: "referenceName" with value: "s3Source" + Then Enter input plugin property: "path" with value: "testSourcePath" + Then Select dropdown plugin property: "format" with option value: "csv" + Then Select radio button plugin property: "verifyCredentials" with value: "false" + Then Click plugin property: "skipHeader" + Then Click plugin property: "enableQuotedValues" + Then Validate "Amazon S3" plugin properties diff --git a/src/e2e-test/resources/errorMessage.properties b/src/e2e-test/resources/errorMessage.properties index 87c8235..3c2be8c 100644 --- a/src/e2e-test/resources/errorMessage.properties +++ b/src/e2e-test/resources/errorMessage.properties @@ -1 +1,2 @@ validationSuccessMessage=No errors found. +errorMessageInvalidCredentials=Invalid credentials: The security token included in the request is invalid. (Service: AWSSecurityTokenService; Status Code: 403; Error Code: InvalidClientTokenId; diff --git a/src/e2e-test/resources/pluginParameters.properties b/src/e2e-test/resources/pluginParameters.properties index 64a1815..5bbe0e0 100644 --- a/src/e2e-test/resources/pluginParameters.properties +++ b/src/e2e-test/resources/pluginParameters.properties @@ -7,3 +7,7 @@ region=us-east-1 testCSV=testdata/test.csv outputCSV=testdata/output.csv outputSchema=[{"key":"id","value":"int"},{"key":"first_name","value":"string"}] +testSourcePath=s3a://adfdfdf +invalidAccessID=fsdsdfs +invalidAccessKey=8sdfjskd +invalidSessionToken=jhakjhsdka