diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index a04e936f5..41a83704f 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -83,6 +83,10 @@ jobs: ORACLE_USERNAME:cdapio-github-builds/ORACLE_USERNAME ORACLE_PASSWORD:cdapio-github-builds/ORACLE_PASSWORD ORACLE_PORT:cdapio-github-builds/ORACLE_PORT + MYSQL_HOST:cdapio-github-builds/MYSQL_HOST + MYSQL_USERNAME:cdapio-github-builds/MYSQL_USERNAME + MYSQL_PASSWORD:cdapio-github-builds/MYSQL_PASSWORD + MYSQL_PORT:cdapio-github-builds/MYSQL_PORT - name: Run required e2e tests if: github.event_name != 'workflow_dispatch' && github.event_name != 'push' && steps.filter.outputs.e2e-test == 'false' @@ -92,6 +96,10 @@ jobs: ORACLE_USERNAME: ${{ steps.secrets.outputs.ORACLE_USERNAME }} ORACLE_PASSWORD: ${{ steps.secrets.outputs.ORACLE_PASSWORD }} ORACLE_PORT: ${{ steps.secrets.outputs.ORACLE_PORT }} + MYSQL_HOST: ${{ steps.secrets.outputs.MYSQL_HOST }} + MYSQL_USERNAME: ${{ steps.secrets.outputs.MYSQL_USERNAME }} + MYSQL_PASSWORD: ${{ steps.secrets.outputs.MYSQL_PASSWORD }} + MYSQL_PORT: ${{ steps.secrets.outputs.MYSQL_PORT }} - name: Run all e2e tests if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' || steps.filter.outputs.e2e-test == 'true' @@ -101,6 +109,10 @@ jobs: ORACLE_USERNAME: ${{ steps.secrets.outputs.ORACLE_USERNAME }} ORACLE_PASSWORD: ${{ steps.secrets.outputs.ORACLE_PASSWORD }} ORACLE_PORT: ${{ steps.secrets.outputs.ORACLE_PORT }} + MYSQL_HOST: ${{ steps.secrets.outputs.MYSQL_HOST }} + MYSQL_USERNAME: ${{ steps.secrets.outputs.MYSQL_USERNAME }} + MYSQL_PASSWORD: ${{ steps.secrets.outputs.MYSQL_PASSWORD }} + MYSQL_PORT: ${{ steps.secrets.outputs.MYSQL_PORT }} - name: Upload report uses: actions/upload-artifact@v3 diff --git a/mysql-plugin/src/e2e-test/features/mysql/MySql.feature b/mysql-plugin/src/e2e-test/features/mysql/MySql.feature index 7fc66c620..47062fe42 100644 --- a/mysql-plugin/src/e2e-test/features/mysql/MySql.feature +++ b/mysql-plugin/src/e2e-test/features/mysql/MySql.feature @@ -25,26 +25,26 @@ Feature: Mysql - Verify Mysql source data transfer When Select plugin: "MySQL" from the plugins list as: "Sink" Then Connect plugins: "MySQL" and "MySQL2" to establish connection Then Navigate to the properties page of plugin: "MySQL" - Then Select dropdown plugin property: "select-jdbcPluginName" with option value: "driver" - Then Replace input plugin property: "host" with value: "host" - Then Replace input plugin property: "port" with value: "port" - Then Replace input plugin property: "user" with value: "username" - Then Replace input plugin property: "password" with value: "password" + Then Select dropdown plugin property: "select-jdbcPluginName" with option value: "driverName" + Then Replace input plugin property: "host" with value: "host" for Credentials and Authorization related fields + Then Replace input plugin property: "port" with value: "port" for Credentials and Authorization related fields + Then Replace input plugin property: "user" with value: "username" for Credentials and Authorization related fields + Then Replace input plugin property: "password" with value: "password" for Credentials and Authorization related fields Then Enter input plugin property: "referenceName" with value: "sourceRef" - Then Replace input plugin property: "database" with value: "database" + Then Replace input plugin property: "database" with value: "databaseName" Then Enter textarea plugin property: "importQuery" with value: "selectQuery" Then Click on the Get Schema button Then Verify the Output Schema matches the Expected Schema: "outputSchema" Then Validate "MySQL" plugin properties Then Close the Plugin Properties page Then Navigate to the properties page of plugin: "MySQL2" - Then Select dropdown plugin property: "select-jdbcPluginName" with option value: "driver" - Then Replace input plugin property: "host" with value: "host" - Then Replace input plugin property: "port" with value: "port" - Then Replace input plugin property: "database" with value: "database" + Then Select dropdown plugin property: "select-jdbcPluginName" with option value: "driverName" + Then Replace input plugin property: "host" with value: "host" for Credentials and Authorization related fields + Then Replace input plugin property: "port" with value: "port" for Credentials and Authorization related fields + Then Replace input plugin property: "database" with value: "databaseName" Then Replace input plugin property: "tableName" with value: "targetTable" - Then Replace input plugin property: "user" with value: "username" - Then Replace input plugin property: "password" with value: "password" + Then Replace input plugin property: "user" with value: "username" for Credentials and Authorization related fields + Then Replace input plugin property: "password" with value: "password" for Credentials and Authorization related fields Then Enter input plugin property: "referenceName" with value: "targetRef" Then Validate "MySQL2" plugin properties Then Close the Plugin Properties page diff --git a/mysql-plugin/src/e2e-test/java/io/cdap/plugin/MysqlClient.java b/mysql-plugin/src/e2e-test/java/io/cdap/plugin/MysqlClient.java index c45c6eb22..73eb672a3 100644 --- a/mysql-plugin/src/e2e-test/java/io/cdap/plugin/MysqlClient.java +++ b/mysql-plugin/src/e2e-test/java/io/cdap/plugin/MysqlClient.java @@ -28,15 +28,13 @@ * MySQL client. */ public class MysqlClient { - private static final String host = PluginPropertyUtils.pluginProp("host"); - private static final int port = Integer.parseInt(PluginPropertyUtils.pluginProp("port")); - private static final String database = PluginPropertyUtils.pluginProp("database"); + private static final String database = PluginPropertyUtils.pluginProp("databaseName"); private static Connection getMysqlConnection() throws SQLException, ClassNotFoundException { Class.forName("com.mysql.cj.jdbc.Driver"); - String username = PluginPropertyUtils.pluginProp("username"); - String password = PluginPropertyUtils.pluginProp("password"); - return DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database, username, password); + return DriverManager.getConnection("jdbc:mysql://" + System.getenv("MYSQL_HOST") + ":" + + System.getenv("MYSQL_PORT") + "/" + database, + System.getenv("MYSQL_USERNAME"), System.getenv("MYSQL_PASSWORD")); } public static int countRecord(String table) throws SQLException, ClassNotFoundException { diff --git a/mysql-plugin/src/e2e-test/resources/pluginParameters.properties b/mysql-plugin/src/e2e-test/resources/pluginParameters.properties index 7371fbff7..aa91b9b41 100644 --- a/mysql-plugin/src/e2e-test/resources/pluginParameters.properties +++ b/mysql-plugin/src/e2e-test/resources/pluginParameters.properties @@ -1,9 +1,9 @@ -driver=mysql -host=34.105.111.83 -username=dummy -password=dummy -database=sakila -port=3306 +driverName=mysql +host=MYSQL_HOST +username=MYSQL_USERNAME +password=MYSQL_PASSWORD +databaseName=sakila +port=MYSQL_PORT selectQuery=select * from ${table} sourceRef=source targetRef=target