forked from cdapio/cdap
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a784b2d
commit 5c8ac3e
Showing
7 changed files
with
257 additions
and
0 deletions.
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
cdap-e2e-tests/src/e2e-test/features/controlcenter/ControlCenter.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# 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. | ||
|
||
@Controlcenter | ||
|
||
Feature: Controlcenter - Validate control center page flow | ||
|
||
Scenario: Verify user is able to click the control center tab and successfully navigates to control center page | ||
Given Open Datafusion Project to configure pipeline | ||
Then Click on the Hamburger bar on the left panel | ||
Then Click on Control Center link from the hamburger menu | ||
Then Verify that the user is navigated to control center page successfully | ||
|
||
@BQ_INSERT_INT_SOURCE_TEST @BQ_SINK_TEST | ||
Scenario: Verify that user is able to create a pipeline and then validate the presence of created pipeline in control center. | ||
Given Open Datafusion Project to configure pipeline | ||
Then Click on the Hamburger bar on the left panel | ||
Then Click on Control Center link from the hamburger menu | ||
Then Click on the Plus Green Button to import the pipelines | ||
Then Verify user is able to click on the create button to create a pipeline successfully | ||
When Expand Plugin group in the LHS plugins list: "Source" | ||
When Select plugin: "BigQuery" from the plugins list as: "Source" | ||
When Expand Plugin group in the LHS plugins list: "Sink" | ||
When Select plugin: "BigQuery" from the plugins list as: "Sink" | ||
Then Connect plugins: "BigQuery" and "BigQuery2" to establish connection | ||
Then Navigate to the properties page of plugin: "BigQuery" | ||
And Enter input plugin property: "referenceName" with value: "Reference" | ||
And Replace input plugin property: "project" with value: "projectId" | ||
And Enter input plugin property: "datasetProject" with value: "projectId" | ||
And Replace input plugin property: "dataset" with value: "dataset" | ||
Then Override Service account details if set in environment variables | ||
And Enter input plugin property: "table" with value: "bqSourceTable" | ||
Then Click on the Get Schema button | ||
Then Validate "BigQuery" plugin properties | ||
And Close the Plugin Properties page | ||
Then Navigate to the properties page of plugin: "BigQuery2" | ||
Then Replace input plugin property: "project" with value: "projectId" | ||
Then Override Service account details if set in environment variables | ||
Then Enter input plugin property: "datasetProject" with value: "projectId" | ||
Then Enter input plugin property: "referenceName" with value: "BQReferenceName" | ||
Then Enter input plugin property: "dataset" with value: "dataset" | ||
Then Enter input plugin property: "table" with value: "bqTargetTable" | ||
Then Validate "BigQuery" plugin properties | ||
And Close the Plugin Properties page | ||
Then Save the pipeline | ||
Then Deploy the pipeline | ||
Then Run the Pipeline in Runtime | ||
Then Wait till pipeline is in running state | ||
Then Verify the pipeline status is "Succeeded" | ||
Then Click on the Hamburger bar on the left panel | ||
Then Click on Control Center link from the hamburger menu | ||
Then Verify the pipeline created successfully is present in control center page | ||
|
||
@BQ_INSERT_INT_SOURCE_TEST @BQ_SINK_TEST | ||
Scenario: Verify that user is able to delete the created pipeline in control center successfully. | ||
Given Open Datafusion Project to configure pipeline | ||
Then Click on the Hamburger bar on the left panel | ||
Then Click on Control Center link from the hamburger menu | ||
Then Click on the Plus Green Button to import the pipelines | ||
Then Verify user is able to click on the create button to create a pipeline successfully | ||
When Expand Plugin group in the LHS plugins list: "Source" | ||
When Select plugin: "BigQuery" from the plugins list as: "Source" | ||
When Expand Plugin group in the LHS plugins list: "Sink" | ||
When Select plugin: "BigQuery" from the plugins list as: "Sink" | ||
Then Connect plugins: "BigQuery" and "BigQuery2" to establish connection | ||
Then Navigate to the properties page of plugin: "BigQuery" | ||
And Enter input plugin property: "referenceName" with value: "Reference" | ||
And Replace input plugin property: "project" with value: "projectId" | ||
And Enter input plugin property: "datasetProject" with value: "projectId" | ||
And Replace input plugin property: "dataset" with value: "dataset" | ||
Then Override Service account details if set in environment variables | ||
And Enter input plugin property: "table" with value: "bqSourceTable" | ||
Then Click on the Get Schema button | ||
Then Validate "BigQuery" plugin properties | ||
And Close the Plugin Properties page | ||
Then Navigate to the properties page of plugin: "BigQuery2" | ||
Then Replace input plugin property: "project" with value: "projectId" | ||
Then Override Service account details if set in environment variables | ||
Then Enter input plugin property: "datasetProject" with value: "projectId" | ||
Then Enter input plugin property: "referenceName" with value: "BQReferenceName" | ||
Then Enter input plugin property: "dataset" with value: "dataset" | ||
Then Enter input plugin property: "table" with value: "bqTargetTable" | ||
Then Validate "BigQuery" plugin properties | ||
And Close the Plugin Properties page | ||
Then Save the pipeline | ||
Then Deploy the pipeline | ||
Then Click on the Hamburger bar on the left panel | ||
Then Click on Control Center link from the hamburger menu | ||
Then Click on the delete icon of the created pipeline and pipeline should get deleted successfully | ||
Then Verify the deleted pipeline is not present in the control center page |
37 changes: 37 additions & 0 deletions
37
cdap-e2e-tests/src/e2e-test/java/io/cdap/cdap/controlcenter/runners/TestRunner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package io.cdap.cdap.controlcenter.runners; | ||
|
||
import io.cucumber.junit.Cucumber; | ||
import io.cucumber.junit.CucumberOptions; | ||
import org.junit.runner.RunWith; | ||
|
||
/** | ||
* Test Runner to execute controlcenter related test cases. | ||
*/ | ||
@RunWith(Cucumber.class) | ||
@CucumberOptions( | ||
features = {"src/e2e-test/features"}, | ||
glue = {"io.cdap.cdap.controlcenter.stepsdesign", "stepsdesign"}, | ||
tags = {"@Controlcenter"}, | ||
plugin = {"pretty", "html:target/cucumber-html-report/controlcenter", | ||
"json:target/cucumber-reports/cucumber-controlcenter.json", | ||
"junit:target/cucumber-reports/cucumber-controlcenter.xml"} | ||
) | ||
public class TestRunner { | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
cdap-e2e-tests/src/e2e-test/java/io/cdap/cdap/controlcenter/runners/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* Package contains the runners for controlcenter features. | ||
*/ | ||
package io.cdap.cdap.controlcenter.runners; |
87 changes: 87 additions & 0 deletions
87
cdap-e2e-tests/src/e2e-test/java/io/cdap/cdap/controlcenter/stepsdesign/TestSetupHooks.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package io.cdap.cdap.controlcenter.stepsdesign; | ||
|
||
import com.google.cloud.bigquery.BigQueryException; | ||
import io.cdap.e2e.utils.BigQueryClient; | ||
import io.cdap.e2e.utils.PluginPropertyUtils; | ||
import io.cucumber.java.After; | ||
import io.cucumber.java.Before; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.junit.Assert; | ||
import stepsdesign.BeforeActions; | ||
|
||
import java.io.IOException; | ||
import java.util.NoSuchElementException; | ||
import java.util.UUID; | ||
|
||
public class TestSetupHooks { | ||
public static String bqTargetTable = StringUtils.EMPTY; | ||
public static String bqSourceTable = StringUtils.EMPTY; | ||
public static String datasetName = PluginPropertyUtils.pluginProp("dataset"); | ||
|
||
@Before(order = 1, value = "@BQ_INSERT_INT_SOURCE_TEST") | ||
public static void createSourceBQTable() throws IOException, InterruptedException { | ||
bqSourceTable = "E2E_SOURCE_" + UUID.randomUUID().toString().replaceAll("-", "_"); | ||
PluginPropertyUtils.addPluginProp("bqSourceTable", bqSourceTable); | ||
BeforeActions.scenario.write("BQ source table name - " + bqSourceTable); | ||
BigQueryClient.getSoleQueryResult("create table `" + datasetName + "." + bqSourceTable + "` " + | ||
"(ID INT64, Name STRING, Price FLOAT64, Customer_Exists BOOL)"); | ||
try { | ||
BigQueryClient.getSoleQueryResult("INSERT INTO `" + datasetName + "." + bqSourceTable + "` " + | ||
"(ID, Name, Price,Customer_Exists)" + | ||
"VALUES" + "(3, 'Rajan Kumar', 100.0, true)"); | ||
} catch (NoSuchElementException e) { | ||
// Insert query does not return any record. | ||
// Iterator on TableResult values in getSoleQueryResult method throws NoSuchElementException | ||
BeforeActions.scenario.write("Error inserting the record in the table" + e.getStackTrace()); | ||
} | ||
PluginPropertyUtils.addPluginProp(" bqSourceTable", bqSourceTable); | ||
BeforeActions.scenario.write("BQ Source Table " + bqSourceTable + " updated successfully"); | ||
} | ||
|
||
@After(order = 1, value = "@BQ_INSERT_INT_SOURCE_TEST") | ||
public static void deleteTempSourceBQTable() throws IOException, InterruptedException { | ||
BigQueryClient.dropBqQuery(bqSourceTable); | ||
PluginPropertyUtils.removePluginProp("bqSourceTable"); | ||
BeforeActions.scenario.write("BQ source Table " + bqSourceTable + " deleted successfully"); | ||
bqSourceTable = StringUtils.EMPTY; | ||
} | ||
|
||
@Before(order = 1, value = "@BQ_SINK_TEST") | ||
public static void setTempTargetBQTableName() { | ||
bqTargetTable = "E2E_TARGET_" + UUID.randomUUID().toString().replaceAll("-", "_"); | ||
PluginPropertyUtils.addPluginProp("bqTargetTable", bqTargetTable); | ||
BeforeActions.scenario.write("BQ Target table name - " + bqTargetTable); | ||
} | ||
|
||
@After(order = 1, value = "@BQ_SINK_TEST") | ||
public static void deleteTempTargetBQTable() throws IOException, InterruptedException { | ||
try { | ||
BigQueryClient.dropBqQuery(bqTargetTable); | ||
PluginPropertyUtils.removePluginProp("bqTargetTable"); | ||
BeforeActions.scenario.write("BQ Target table - " + bqTargetTable + " deleted successfully"); | ||
bqTargetTable = StringUtils.EMPTY; | ||
} catch (BigQueryException e) { | ||
if (e.getMessage().contains("Not found: Table")) { | ||
BeforeActions.scenario.write("BQ Target Table " + bqTargetTable + " does not exist"); | ||
} else { | ||
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
validationSuccessMessage=No errors found. |
4 changes: 4 additions & 0 deletions
4
cdap-e2e-tests/src/e2e-test/resources/pluginDataCyAttributes.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
projectId=project | ||
datasetProjectId=datasetProject | ||
referenceName=referenceName | ||
table=table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters