Skip to content

Commit c034bcd

Browse files
authored
Merge pull request #345 from data-integrations/mysql_secrets
Added secretsmanager for MySQL E2E tests
2 parents e25930f + ae467c2 commit c034bcd

File tree

4 files changed

+34
-24
lines changed

4 files changed

+34
-24
lines changed

.github/workflows/e2e.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ jobs:
8383
ORACLE_USERNAME:cdapio-github-builds/ORACLE_USERNAME
8484
ORACLE_PASSWORD:cdapio-github-builds/ORACLE_PASSWORD
8585
ORACLE_PORT:cdapio-github-builds/ORACLE_PORT
86+
MYSQL_HOST:cdapio-github-builds/MYSQL_HOST
87+
MYSQL_USERNAME:cdapio-github-builds/MYSQL_USERNAME
88+
MYSQL_PASSWORD:cdapio-github-builds/MYSQL_PASSWORD
89+
MYSQL_PORT:cdapio-github-builds/MYSQL_PORT
8690
8791
- name: Run required e2e tests
8892
if: github.event_name != 'workflow_dispatch' && github.event_name != 'push' && steps.filter.outputs.e2e-test == 'false'
@@ -92,6 +96,10 @@ jobs:
9296
ORACLE_USERNAME: ${{ steps.secrets.outputs.ORACLE_USERNAME }}
9397
ORACLE_PASSWORD: ${{ steps.secrets.outputs.ORACLE_PASSWORD }}
9498
ORACLE_PORT: ${{ steps.secrets.outputs.ORACLE_PORT }}
99+
MYSQL_HOST: ${{ steps.secrets.outputs.MYSQL_HOST }}
100+
MYSQL_USERNAME: ${{ steps.secrets.outputs.MYSQL_USERNAME }}
101+
MYSQL_PASSWORD: ${{ steps.secrets.outputs.MYSQL_PASSWORD }}
102+
MYSQL_PORT: ${{ steps.secrets.outputs.MYSQL_PORT }}
95103

96104
- name: Run all e2e tests
97105
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' || steps.filter.outputs.e2e-test == 'true'
@@ -101,6 +109,10 @@ jobs:
101109
ORACLE_USERNAME: ${{ steps.secrets.outputs.ORACLE_USERNAME }}
102110
ORACLE_PASSWORD: ${{ steps.secrets.outputs.ORACLE_PASSWORD }}
103111
ORACLE_PORT: ${{ steps.secrets.outputs.ORACLE_PORT }}
112+
MYSQL_HOST: ${{ steps.secrets.outputs.MYSQL_HOST }}
113+
MYSQL_USERNAME: ${{ steps.secrets.outputs.MYSQL_USERNAME }}
114+
MYSQL_PASSWORD: ${{ steps.secrets.outputs.MYSQL_PASSWORD }}
115+
MYSQL_PORT: ${{ steps.secrets.outputs.MYSQL_PORT }}
104116

105117
- name: Upload report
106118
uses: actions/upload-artifact@v3

mysql-plugin/src/e2e-test/features/mysql/MySql.feature

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,26 @@ Feature: Mysql - Verify Mysql source data transfer
2525
When Select plugin: "MySQL" from the plugins list as: "Sink"
2626
Then Connect plugins: "MySQL" and "MySQL2" to establish connection
2727
Then Navigate to the properties page of plugin: "MySQL"
28-
Then Select dropdown plugin property: "select-jdbcPluginName" with option value: "driver"
29-
Then Replace input plugin property: "host" with value: "host"
30-
Then Replace input plugin property: "port" with value: "port"
31-
Then Replace input plugin property: "user" with value: "username"
32-
Then Replace input plugin property: "password" with value: "password"
28+
Then Select dropdown plugin property: "select-jdbcPluginName" with option value: "driverName"
29+
Then Replace input plugin property: "host" with value: "host" for Credentials and Authorization related fields
30+
Then Replace input plugin property: "port" with value: "port" for Credentials and Authorization related fields
31+
Then Replace input plugin property: "user" with value: "username" for Credentials and Authorization related fields
32+
Then Replace input plugin property: "password" with value: "password" for Credentials and Authorization related fields
3333
Then Enter input plugin property: "referenceName" with value: "sourceRef"
34-
Then Replace input plugin property: "database" with value: "database"
34+
Then Replace input plugin property: "database" with value: "databaseName"
3535
Then Enter textarea plugin property: "importQuery" with value: "selectQuery"
3636
Then Click on the Get Schema button
3737
Then Verify the Output Schema matches the Expected Schema: "outputSchema"
3838
Then Validate "MySQL" plugin properties
3939
Then Close the Plugin Properties page
4040
Then Navigate to the properties page of plugin: "MySQL2"
41-
Then Select dropdown plugin property: "select-jdbcPluginName" with option value: "driver"
42-
Then Replace input plugin property: "host" with value: "host"
43-
Then Replace input plugin property: "port" with value: "port"
44-
Then Replace input plugin property: "database" with value: "database"
41+
Then Select dropdown plugin property: "select-jdbcPluginName" with option value: "driverName"
42+
Then Replace input plugin property: "host" with value: "host" for Credentials and Authorization related fields
43+
Then Replace input plugin property: "port" with value: "port" for Credentials and Authorization related fields
44+
Then Replace input plugin property: "database" with value: "databaseName"
4545
Then Replace input plugin property: "tableName" with value: "targetTable"
46-
Then Replace input plugin property: "user" with value: "username"
47-
Then Replace input plugin property: "password" with value: "password"
46+
Then Replace input plugin property: "user" with value: "username" for Credentials and Authorization related fields
47+
Then Replace input plugin property: "password" with value: "password" for Credentials and Authorization related fields
4848
Then Enter input plugin property: "referenceName" with value: "targetRef"
4949
Then Validate "MySQL2" plugin properties
5050
Then Close the Plugin Properties page

mysql-plugin/src/e2e-test/java/io/cdap/plugin/MysqlClient.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@
2828
* MySQL client.
2929
*/
3030
public class MysqlClient {
31-
private static final String host = PluginPropertyUtils.pluginProp("host");
32-
private static final int port = Integer.parseInt(PluginPropertyUtils.pluginProp("port"));
33-
private static final String database = PluginPropertyUtils.pluginProp("database");
31+
private static final String database = PluginPropertyUtils.pluginProp("databaseName");
3432

3533
private static Connection getMysqlConnection() throws SQLException, ClassNotFoundException {
3634
Class.forName("com.mysql.cj.jdbc.Driver");
37-
String username = PluginPropertyUtils.pluginProp("username");
38-
String password = PluginPropertyUtils.pluginProp("password");
39-
return DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database, username, password);
35+
return DriverManager.getConnection("jdbc:mysql://" + System.getenv("MYSQL_HOST") + ":" +
36+
System.getenv("MYSQL_PORT") + "/" + database,
37+
System.getenv("MYSQL_USERNAME"), System.getenv("MYSQL_PASSWORD"));
4038
}
4139

4240
public static int countRecord(String table) throws SQLException, ClassNotFoundException {

mysql-plugin/src/e2e-test/resources/pluginParameters.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
driver=mysql
2-
host=34.105.111.83
3-
username=dummy
4-
password=dummy
5-
database=sakila
6-
port=3306
1+
driverName=mysql
2+
host=MYSQL_HOST
3+
username=MYSQL_USERNAME
4+
password=MYSQL_PASSWORD
5+
databaseName=sakila
6+
port=MYSQL_PORT
77
selectQuery=select * from ${table}
88
sourceRef=source
99
targetRef=target

0 commit comments

Comments
 (0)