Skip to content

Commit

Permalink
Merge pull request #196 from cloudsufi/e2e_amazonS3_test
Browse files Browse the repository at this point in the history
amazon s3 e2e test for incorrect credential validation
  • Loading branch information
itsankit-google authored Dec 5, 2023
2 parents e6fe00e + b431b60 commit 1779c2c
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
40 changes: 32 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<commons.logging.version>1.1.3</commons.logging.version>
<httpclient.version>4.5.14</httpclient.version>
<main.basedir>${project.basedir}</main.basedir>
<testSourceLocation>${project.basedir}/src/test/java/</testSourceLocation>
</properties>

<dependencies>
Expand Down Expand Up @@ -284,7 +285,7 @@
</dependencies>

<build>
<testSourceDirectory>src/test/java</testSourceDirectory>
<testSourceDirectory>${testSourceLocation}</testSourceDirectory>
<pluginManagement>
<plugins>
<plugin>
Expand Down Expand Up @@ -408,6 +409,7 @@
<id>e2e-tests</id>
<properties>
<testSourceLocation>src/e2e-test/java</testSourceLocation>
<TEST_RUNNER>TestRunner.java</TEST_RUNNER>
</properties>
<build>
<testResources>
Expand Down Expand Up @@ -444,6 +446,7 @@
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
Expand Down Expand Up @@ -501,23 +504,44 @@
</plugins>
</build>


<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.7</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/io.netty/netty-all -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.100.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cdap.tests.e2e</groupId>
<artifactId>cdap-e2e-framework</artifactId>
<version>0.2.0-SNAPSHOT</version>
<version>0.4.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.8</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>27.0.1-jre</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
49 changes: 49 additions & 0 deletions src/e2e-test/features/DesignTimeValidation.feature
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions src/e2e-test/resources/errorMessage.properties
Original file line number Diff line number Diff line change
@@ -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;
4 changes: 4 additions & 0 deletions src/e2e-test/resources/pluginParameters.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1779c2c

Please sign in to comment.