Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

control center cdap #8

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
rahuldash171 marked this conversation as resolved.
Show resolved Hide resolved
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
rahuldash171 marked this conversation as resolved.
Show resolved Hide resolved
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
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 {

}
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;
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());
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
validationSuccessMessage=No errors found.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
projectId=project
datasetProjectId=datasetProject
referenceName=referenceName
table=table
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@ clientName=cdap
clientUrl=http://localhost:11011
serverUrl=https://placeholder.com/api
# command to generate token: gcloud auth print-access-token

## CONTROLCENTER-START
serverAccessToken=placeholder
bqSourceTable=dummy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add start and end comments for control center feature

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the comments

dataset=bq_automation
projectId=cdf-athena
datasetprojectId=cdf-athena
## CONTROLCENTER-END