Skip to content

Commit 8681acf

Browse files
itsmekumaripoojantcs
authored andcommitted
Fix MySQL E2E test hooks
1 parent bc60c65 commit 8681acf

File tree

10 files changed

+73
-32
lines changed

10 files changed

+73
-32
lines changed

mysql-plugin/src/e2e-test/features/mysqlsink/DesignTime.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
@Mysql
1616
Feature: MySQL Sink - Design time scenarios
1717

18-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required
18+
@MYSQL_TARGET_TEST @Mysql_Required
1919
Scenario: Verify user can validate successfully when sink plugin is configured for table with basic details
2020
Given Open Datafusion Project to configure pipeline
2121
When Expand Plugin group in the LHS plugins list: "Sink"
@@ -31,7 +31,7 @@ Feature: MySQL Sink - Design time scenarios
3131
Then Enter input plugin property: "referenceName" with value: "targetRef"
3232
Then Validate "MySQL2" plugin properties
3333

34-
@MYSQL_SOURCE_TEST @CONNECTION @MYSQL_SINK_TEST @Mysql_Required
34+
@MYSQL_TARGET_TEST @CONNECTION @Mysql_Required
3535
Scenario: Verify the MySQL Sink plugin using connection manager functionality
3636
Given Open Datafusion Project to configure pipeline
3737
When Expand Plugin group in the LHS plugins list: "Sink"
@@ -58,7 +58,7 @@ Feature: MySQL Sink - Design time scenarios
5858
Then Validate "MySQL" plugin properties
5959
Then Close the Plugin Properties page
6060

61-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required
61+
@MYSQL_TARGET_TEST @Mysql_Required
6262
Scenario: Verify user should be able to validate sink plugin successfully by setting the advanced section fields
6363
Given Open Datafusion Project to configure pipeline
6464
When Expand Plugin group in the LHS plugins list: "Sink"

mysql-plugin/src/e2e-test/features/mysqlsink/DesignTimeValidation.feature

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
@Mysql
1616
Feature: MySQL Sink - Design time validation scenarios
1717

18-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required
18+
@MYSQL_SOURCE_TEST @MYSQL_TARGET_TEST @Mysql_Required
1919
Scenario: Verify Database field validation error message with invalid test data
2020
Given Open Datafusion Project to configure pipeline
2121
When Expand Plugin group in the LHS plugins list: "Source"
@@ -46,7 +46,7 @@ Feature: MySQL Sink - Design time validation scenarios
4646
Then Click on the Validate button
4747
Then Verify that the Plugin is displaying an error message: "invalid.sink.database.message" on the header
4848

49-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required
49+
@MYSQL_SOURCE_TEST @MYSQL_TARGET_TEST @Mysql_Required
5050
Scenario: Verify Table Name Field validation error message with invalid test data
5151
Given Open Datafusion Project to configure pipeline
5252
When Expand Plugin group in the LHS plugins list: "Source"
@@ -77,7 +77,7 @@ Feature: MySQL Sink - Design time validation scenarios
7777
Then Click on the Validate button
7878
Then Verify that the Plugin Property: "tableName" is displaying an in-line error message: "invalidtableName.error.message"
7979

80-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required
80+
@MYSQL_SOURCE_TEST @MYSQL_TARGET_TEST @Mysql_Required
8181
Scenario: Verify Reference Name field validation error message with invalid test data
8282
Given Open Datafusion Project to configure pipeline
8383
When Expand Plugin group in the LHS plugins list: "Source"
@@ -108,7 +108,7 @@ Feature: MySQL Sink - Design time validation scenarios
108108
Then Click on the Validate button
109109
Then Verify that the Plugin Property: "referenceName" is displaying an in-line error message: "invalidreferenceName.error.message"
110110

111-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required
111+
@MYSQL_SOURCE_TEST @MYSQL_TARGET_TEST @Mysql_Required
112112
Scenario: Verify the Username field validation error message with blank value
113113
Given Open Datafusion Project to configure pipeline
114114
When Expand Plugin group in the LHS plugins list: "Source"
@@ -138,7 +138,7 @@ Feature: MySQL Sink - Design time validation scenarios
138138
Then Click on the Validate button
139139
Then Verify that the Plugin Property: "user" is displaying an in-line error message: "blank.username.message"
140140

141-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required
141+
@MYSQL_SOURCE_TEST @MYSQL_TARGET_TEST @Mysql_Required
142142
Scenario: Verify the host validation error message with blank value
143143
Given Open Datafusion Project to configure pipeline
144144
When Expand Plugin group in the LHS plugins list: "Source"

mysql-plugin/src/e2e-test/features/mysqlsink/DesignTimeWithMacros.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
@Mysql
1616
Feature: MySQL Sink - Design time scenarios (macro)
1717

18-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required
18+
@MYSQL_SOURCE_TEST @MYSQL_TARGET_TEST @Mysql_Required
1919
Scenario: Verify user should be able to validate sink plugin with macros for Connection section
2020
Given Open Datafusion Project to configure pipeline
2121
When Expand Plugin group in the LHS plugins list: "Source"
@@ -45,7 +45,7 @@ Feature: MySQL Sink - Design time scenarios (macro)
4545
Then Replace input plugin property: "tableName" with value: "targetTable"
4646
Then Click on the Validate button
4747

48-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required
48+
@MYSQL_SOURCE_TEST @MYSQL_TARGET_TEST @Mysql_Required
4949
Scenario: Verify user should be able to validate sink plugin with macros for Basic section
5050
Given Open Datafusion Project to configure pipeline
5151
When Expand Plugin group in the LHS plugins list: "Source"

mysql-plugin/src/e2e-test/features/mysqlsink/RunTime.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Feature: MySQL Sink - Run time scenarios
5555
Then Verify the pipeline status is "Succeeded"
5656
Then Validate the values of records transferred to target MySQL table is equal to the values from source BigQuery table
5757

58-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required
58+
@MYSQL_SOURCE_TEST @MYSQL_TARGET_TEST @Mysql_Required
5959
Scenario: To verify data is getting transferred from Mysql to Mysql successfully
6060
Given Open Datafusion Project to configure pipeline
6161
When Expand Plugin group in the LHS plugins list: "Source"
@@ -100,7 +100,7 @@ Feature: MySQL Sink - Run time scenarios
100100
Then Verify the pipeline status is "Succeeded"
101101
Then Validate the values of records transferred to target table is equal to the values from source table
102102

103-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required
103+
@MYSQL_SOURCE_TEST @MYSQL_TARGET_TEST @Mysql_Required
104104
Scenario: To verify data is getting transferred from Mysql to Mysql successfully when advance section details are set
105105
Given Open Datafusion Project to configure pipeline
106106
When Expand Plugin group in the LHS plugins list: "Source"

mysql-plugin/src/e2e-test/features/mysqlsink/RunTimeWithMacros.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Feature: MySQL Sink - Run time scenarios (macro)
6565
Then Verify the pipeline status is "Succeeded"
6666
Then Validate the values of records transferred to target Big Query table is equal to the values from source table
6767

68-
@BQ_SOURCE_TEST @MYSQL_TARGET_TABLE @Mysql_Required
68+
@BQ_SOURCE_TEST @Mysql_Required
6969
Scenario: Verify that the pipeline fails when user provides invalid Table Name of plugin with Macros
7070
Given Open Datafusion Project to configure pipeline
7171
When Expand Plugin group in the LHS plugins list: "Source"

mysql-plugin/src/e2e-test/features/mysqlsource/Datatypes.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
@Mysql
1818
Feature: Mysql - Verify Mysql source data transfer for different datatype
1919

20-
@MYSQL_SOURCE_DATATYPES_TEST @MYSQL_SINK_TEST @Mysql_Required
20+
@MYSQL_SOURCE_DATATYPES_TEST @MYSQL_TARGET_DATATYPES_TEST @Mysql_Required
2121
Scenario: To verify data is getting transferred from Mysql to Mysql successfully
2222
Given Open Datafusion Project to configure pipeline
2323
When Expand Plugin group in the LHS plugins list: "Source"
@@ -61,7 +61,7 @@ Feature: Mysql - Verify Mysql source data transfer for different datatype
6161
Then Verify the pipeline status is "Succeeded"
6262
Then Validate the values of records transferred to target table is equal to the values from source table
6363

64-
@MYSQL_SOURCE_DATATYPES_TEST @BQ_SINK @Mysql_Required @Plugin-20670
64+
@MYSQL_SOURCE_DATATYPES_TEST @BQ_SINK @BQ_SINK_CLEANUP @Mysql_Required @Plugin-20670
6565
Scenario: To verify data is getting transferred from Mysql to BigQuery successfully
6666
Given Open Datafusion Project to configure pipeline
6767
When Expand Plugin group in the LHS plugins list: "Source"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
@Mysql
1818
Feature: Mysql - Verify Mysql source data transfer
1919

20-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required
20+
@MYSQL_SOURCE_TEST @MYSQL_TARGET_TEST @Mysql_Required
2121
Scenario: To verify data is getting transferred from Mysql to Mysql successfully
2222
Given Open Datafusion Project to configure pipeline
2323
When Expand Plugin group in the LHS plugins list: "Source"

mysql-plugin/src/e2e-test/features/mysqlsource/RunTime.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Feature: MySQL Source - Run time scenarios
6060
Then Validate OUT record count is equal to records transferred to target BigQuery table
6161
Then Validate the values of records transferred to target Big Query table is equal to the values from source table
6262

63-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required @test
63+
@MYSQL_SOURCE_TEST @MYSQL_TARGET_TEST @Mysql_Required @test
6464
Scenario: To verify data is getting transferred from Mysql to Mysql successfully when advance section details are set
6565
Given Open Datafusion Project to configure pipeline
6666
When Expand Plugin group in the LHS plugins list: "Source"
@@ -105,7 +105,7 @@ Feature: MySQL Source - Run time scenarios
105105
Then Verify the pipeline status is "Succeeded"
106106
Then Validate the values of records transferred to target table is equal to the values from source table
107107

108-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required
108+
@MYSQL_SOURCE_TEST @MYSQL_TARGET_TEST @Mysql_Required
109109
Scenario: Verify the pipeline fails when plugin is configured with invalid bounding query
110110
Given Open Datafusion Project to configure pipeline
111111
When Expand Plugin group in the LHS plugins list: "Source"
@@ -145,7 +145,7 @@ Feature: MySQL Source - Run time scenarios
145145
Then Wait till pipeline preview is in running state
146146
Then Verify the preview run status of pipeline in the logs is "failed"
147147

148-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required
148+
@MYSQL_SOURCE_TEST @MYSQL_TARGET_TEST @Mysql_Required
149149
Scenario: To verify data is getting transferred from Mysql to Mysql successfully when connection arguments are set
150150
Given Open Datafusion Project to configure pipeline
151151
When Expand Plugin group in the LHS plugins list: "Source"

mysql-plugin/src/e2e-test/features/mysqlsource/RunTimeWithMacros.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
@Mysql
1616
Feature: MySQL Source - Run time scenarios (macro)
1717

18-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required
18+
@MYSQL_SOURCE_TEST @MYSQL_TARGET_TEST @Mysql_Required
1919
Scenario: To verify data is getting transferred from Mysql to Mysql successfully using macros for Connection section
2020
Given Open Datafusion Project to configure pipeline
2121
When Expand Plugin group in the LHS plugins list: "Source"
@@ -68,7 +68,7 @@ Feature: MySQL Source - Run time scenarios (macro)
6868
Then Verify the pipeline status is "Succeeded"
6969
Then Validate the values of records transferred to target table is equal to the values from source table
7070

71-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required
71+
@MYSQL_SOURCE_TEST @MYSQL_TARGET_TEST @Mysql_Required
7272
Scenario: To verify data is getting transferred from Mysql to Mysql successfully using macros for Basic section
7373
Given Open Datafusion Project to configure pipeline
7474
When Expand Plugin group in the LHS plugins list: "Source"
@@ -166,7 +166,7 @@ Feature: MySQL Source - Run time scenarios (macro)
166166
Then Verify the pipeline status is "Succeeded"
167167
Then Validate the values of records transferred to target Big Query table is equal to the values from source table
168168

169-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required
169+
@MYSQL_SOURCE_TEST @MYSQL_TARGET_TEST @Mysql_Required
170170
Scenario: Verify that pipeline fails when user provides invalid Table name in importQuery of plugin with Macros
171171
Given Open Datafusion Project to configure pipeline
172172
When Expand Plugin group in the LHS plugins list: "Source"
@@ -203,7 +203,7 @@ Feature: MySQL Source - Run time scenarios (macro)
203203
And Wait till pipeline is in running state
204204
And Verify the pipeline status is "Failed"
205205

206-
@MYSQL_SOURCE_TEST @MYSQL_SINK_TEST @Mysql_Required
206+
@MYSQL_SOURCE_TEST @MYSQL_TARGET_TEST @Mysql_Required
207207
Scenario: Verify that pipeline fails when user provides invalid Credentials for connection with Macros
208208
Given Open Datafusion Project to configure pipeline
209209
When Expand Plugin group in the LHS plugins list: "Source"

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

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,59 @@ public static void initializeDBProperties() {
6464
}
6565

6666
@Before(order = 2, value = "@MYSQL_SOURCE_TEST")
67-
public static void createTables() throws SQLException, ClassNotFoundException {
67+
public static void createSourceTables() throws SQLException, ClassNotFoundException {
6868
MysqlClient.createSourceTable(PluginPropertyUtils.pluginProp("sourceTable"));
69+
BeforeActions.scenario.write("MYSQL Source table - " + PluginPropertyUtils.pluginProp("sourceTable")
70+
+ " created successfully");
71+
}
72+
73+
@Before(order = 2, value = "@MYSQL_TARGET_TEST")
74+
public static void createTargetTables() throws SQLException, ClassNotFoundException {
6975
MysqlClient.createTargetTable(PluginPropertyUtils.pluginProp("targetTable"));
76+
BeforeActions.scenario.write("MYSQL Target table - " + PluginPropertyUtils.pluginProp("targetTable")
77+
+ " created successfully");
7078
}
7179

7280
@Before(order = 2, value = "@MYSQL_SOURCE_DATATYPES_TEST")
73-
public static void createDatatypesTable() throws SQLException, ClassNotFoundException {
81+
public static void createSourceDatatypesTable() throws SQLException, ClassNotFoundException {
7482
MysqlClient.createSourceDatatypesTable(PluginPropertyUtils.pluginProp("sourceTable"));
83+
BeforeActions.scenario.write("MYSQL Source Table - " + PluginPropertyUtils.pluginProp("sourceTable") +
84+
" created successfully");
85+
}
86+
87+
@Before(order = 2, value = "@MYSQL_TARGET_DATATYPES_TEST")
88+
public static void createTargetDatatypesTable() throws SQLException, ClassNotFoundException {
7589
MysqlClient.createTargetDatatypesTable(PluginPropertyUtils.pluginProp("targetTable"));
90+
BeforeActions.scenario.write("MYSQL Target table - " + PluginPropertyUtils.pluginProp("targetTable")
91+
+ " created successfully");
7692
}
7793

78-
@After(order = 2, value = "@MYSQL_SINK_TEST")
79-
public static void dropTables() throws SQLException, ClassNotFoundException {
80-
MysqlClient.dropTables(new String[]{PluginPropertyUtils.pluginProp("sourceTable"),
81-
PluginPropertyUtils.pluginProp("targetTable")});
94+
@After(order = 2, value = "@MYSQL_SOURCE_TEST")
95+
public static void dropSourceTables() throws SQLException, ClassNotFoundException {
96+
MysqlClient.dropTable(PluginPropertyUtils.pluginProp("sourceTable"));
97+
BeforeActions.scenario.write("MYSQL Source Table - " + PluginPropertyUtils.pluginProp("sourceTable") +
98+
" deleted successfully");
99+
}
100+
101+
@After(order = 2, value = "@MYSQL_TARGET_TEST")
102+
public static void dropTargetTables() throws SQLException, ClassNotFoundException {
103+
MysqlClient.dropTable(PluginPropertyUtils.pluginProp("targetTable"));
104+
BeforeActions.scenario.write("MYSQL Target table - " + PluginPropertyUtils.pluginProp("targetTable")
105+
+ " deleted successfully");
106+
}
107+
108+
@After(order = 2, value = "@MYSQL_SOURCE_DATATYPES_TEST")
109+
public static void dropSourceDatatypeTables() throws SQLException, ClassNotFoundException {
110+
MysqlClient.dropTable(PluginPropertyUtils.pluginProp("sourceTable"));
111+
BeforeActions.scenario.write("MYSQL Source Table - " + PluginPropertyUtils.pluginProp("sourceTable") +
112+
" deleted successfully");
113+
}
114+
115+
@After(order = 2, value = "@MYSQL_TARGET_DATATYPES_TEST")
116+
public static void dropTargetDatatypeTables() throws SQLException, ClassNotFoundException {
117+
MysqlClient.dropTable(PluginPropertyUtils.pluginProp("targetTable"));
118+
BeforeActions.scenario.write("MYSQL Target table - " + PluginPropertyUtils.pluginProp("targetTable")
119+
+ " deleted successfully");
82120
}
83121

84122
@Before(order = 1, value = "@BQ_SINK")
@@ -103,18 +141,20 @@ public static void deleteTempTargetBQTable() throws IOException, InterruptedExce
103141
}
104142
}
105143

106-
@Before(order = 1, value = "@MYSQL_TARGET_TABLE")
144+
@Before(order = 2, value = "@MYSQL_TARGET_TABLE")
107145
public static void createMysqlTargetTable() throws SQLException, ClassNotFoundException {
108146
MysqlClient.createTargetTable1(PluginPropertyUtils.pluginProp("targetTable"));
147+
BeforeActions.scenario.write("MYSQL Target table - " + PluginPropertyUtils.pluginProp("targetTable")
148+
+ " created successfully");
109149
}
110150

111151
@After(order = 2, value = "@MYSQL_TARGET_TABLE")
112152
public static void dropTargetTable() throws SQLException, ClassNotFoundException {
113153
MysqlClient.dropTable(PluginPropertyUtils.pluginProp("targetTable"));
154+
BeforeActions.scenario.write("MYSQL Target table - " + PluginPropertyUtils.pluginProp("targetTable")
155+
+ " deleted successfully");
114156
}
115157

116-
117-
118158
/**
119159
* Create BigQuery table.
120160
*/
@@ -173,3 +213,4 @@ public static void setNewConnectionName() {
173213
BeforeActions.scenario.write("New Connection name: " + connectionName);
174214
}
175215
}
216+

0 commit comments

Comments
 (0)