Skip to content

Commit 2e56d59

Browse files
committed
NameSpaceAdmin feature design and Runtime scenario addition.
1 parent 7e9946b commit 2e56d59

File tree

9 files changed

+436
-0
lines changed

9 files changed

+436
-0
lines changed
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
#
2+
# Copyright © 2023 Cask Data, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
# use this file except in compliance with the License. You may obtain a copy of
6+
# the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
# License for the specific language governing permissions and limitations under
14+
# the License.
15+
#
16+
@Namespaceadmin
17+
Feature: NameSpaceAdmin - Validate nameSpace admin design time scenarios
18+
19+
@Namespaceadmin
20+
Scenario:Verify user is able to click on the namespace admin tab and successfully navigates to the page
21+
Given Open Datafusion Project to configure pipeline
22+
When Click on the Hamburger bar on the left panel
23+
Then Click on NameSpace Admin link from the menu
24+
Then Verify if user successfully navigated to namespace admin page
25+
26+
@Namespaceadmin
27+
Scenario:Validate user is able to open compute profile page and create a profile for selected a provisioner
28+
Given Open Datafusion Project to configure pipeline
29+
Then Click on the Hamburger bar on the left panel
30+
Then Click on NameSpace Admin link from the menu
31+
Then Click on create profile button for "default" Namespace
32+
Then Select a provisioner: "remoteHadoopProvisioner" for the compute profile
33+
Then Verify the Create a Profile page is loaded for selected provisioner
34+
Then Enter input plugin property: "profileLabel" with value: "validProfile"
35+
Then Enter textarea plugin property: "profileDescription" with value: "validDescription"
36+
Then Enter input plugin property: "host" with value: "testHost"
37+
Then Enter input plugin property: "user" with value: "testUser"
38+
Then Enter textarea plugin property: "sshKey" with value: "testSSHKey"
39+
Then Click on: "Create" button in the properties
40+
Then Verify the created compute profile: "validProfile" is displayed in system compute profile list
41+
42+
43+
@Namespaceadmin
44+
Scenario: Validate user is able to create new namespace preferences and able to delete the added namespace preferences successfully
45+
Given Open Datafusion Project to configure pipeline
46+
Then Click on the Hamburger bar on the left panel
47+
Then Click on NameSpace Admin link from the menu
48+
Then Click "preferences" tab from Configuration page for "default" Namespace
49+
Then Click on edit namespace preferences to set namespace preferences
50+
Then Set namespace preferences with key: "keyValue" and value: "nameSpacePreferences1"
51+
Then Click on the Save & Close preferences button
52+
Then Click on edit namespace preferences to set namespace preferences
53+
Then Delete the preferences
54+
Then Click on the Save & Close preferences button
55+
56+
Scenario: Validate user is able to add multiple namespace preferences inside namespace admin successfully
57+
Given Open Datafusion Project to configure pipeline
58+
Then Click on the Hamburger bar on the left panel
59+
Then Click on NameSpace Admin link from the menu
60+
Then Click "preferences" tab from Configuration page for "default" Namespace
61+
Then Click on edit namespace preferences to set namespace preferences
62+
Then Set namespace preferences with key: "keyValue" and value: "nameSpacePreferences2"
63+
Then Click on the Save & Close preferences button
64+
Then Click on edit namespace preferences to set namespace preferences
65+
Then Delete the preferences
66+
Then Delete the preferences
67+
Then Click on the Save & Close preferences button
68+
69+
Scenario: Validate user is able reset the namespace preferences added inside namespace admin successfully
70+
Given Open Datafusion Project to configure pipeline
71+
Then Click on the Hamburger bar on the left panel
72+
Then Click on NameSpace Admin link from the menu
73+
Then Click "preferences" tab from Configuration page for "default" Namespace
74+
Then Click on edit namespace preferences to set namespace preferences
75+
Then Set namespace preferences with key: "keyValue" and value: "nameSpacePreferences1"
76+
Then Reset the preferences
77+
Then Verify the reset is successful for added preferences
78+
79+
Scenario: To verify the validation error message with invalid cluster name
80+
Given Open Datafusion Project to configure pipeline
81+
Then Click on the Hamburger bar on the left panel
82+
Then Click on NameSpace Admin link from the menu
83+
Then Click on create profile button for "default" Namespace
84+
Then Select a provisioner: "existingDataProc" for the compute profile
85+
Then Enter input plugin property: "profileLabel" with value: "validProfile"
86+
Then Enter textarea plugin property: "profileDescription" with value: "validDescription"
87+
Then Enter input plugin property: "clusterName" with value: "invalidClusterName"
88+
Then Click on: "Create" button in the properties
89+
Then Verify that the compute profile is displaying an error message: "errorInvalidClusterName" on the footer
90+
91+
Scenario:To verify the validation error message with invalid profile name
92+
Given Open Datafusion Project to configure pipeline
93+
Then Click on the Hamburger bar on the left panel
94+
Then Click on NameSpace Admin link from the menu
95+
Then Click on create profile button for "default" Namespace
96+
Then Select a provisioner: "existingDataProc" for the compute profile
97+
Then Enter input plugin property: "profileLabel" with value: "invalidProfile"
98+
Then Enter textarea plugin property: "profileDescription" with value: "validDescription"
99+
Then Enter input plugin property: "clusterName" with value: "validClusterName"
100+
Then Click on: "Create" button in the properties
101+
Then Verify that the compute profile is displaying an error message: "errorInvalidProfileName" on the footer
102+
103+
Scenario:To verify the validation error message with invalid namespace name
104+
Given Open Datafusion Project to configure pipeline
105+
Then Click on the Hamburger bar on the left panel
106+
Then Click on Namespace dropdown button
107+
Then Click on the Add Namespace tab
108+
Then Enter the New Namespace Name with value: "invalidNamespaceName"
109+
Then Enter the Namespace Description with value: "validNamespaceDescription"
110+
Then Click on: "Finish" button in the properties
111+
Then Verify the failed error message: "errorInvalidNamespace" displayed on dialog box
112+
113+
Scenario: Validate user is able to create new namespace from hamburger menu and switch to newly created namespace
114+
Given Open Datafusion Project to configure pipeline
115+
Then Click on the Hamburger bar on the left panel
116+
Then Click on Namespace dropdown button
117+
Then Click on the Add Namespace tab
118+
Then Enter the New Namespace Name with value: "validNamespaceName"
119+
Then Enter the Namespace Description with value: "validNamespaceDescription"
120+
Then Click on: "Finish" button in the properties
121+
Then Switch to the newly created Namespace
122+
Then Click on the Hamburger bar on the left panel
123+
Then Verify the namespace is switched to "validNamespaceName" successfully
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#
2+
# Copyright © 2023 Cask Data, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
# use this file except in compliance with the License. You may obtain a copy of
6+
# the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
# License for the specific language governing permissions and limitations under
14+
# the License.
15+
#
16+
@Namespaceadmin
17+
Feature: NameSpaceAdmin - Validate nameSpace admin run time scenarios
18+
19+
@BQ_SOURCE_TEST @BQ_SINK_TEST
20+
Scenario:To verify if user is able to run a pipeline successfully using the namespace preferences
21+
Given Open Datafusion Project to configure pipeline
22+
Then Click on the Hamburger bar on the left panel
23+
Then Click on NameSpace Admin link from the menu
24+
Then Click "preferences" tab from Configuration page for "default" Namespace
25+
Then Click on edit namespace preferences to set namespace preferences
26+
Then Set nameSpace preferences with key: "keyValue" and value: "nameSpacePreferences2"
27+
Then Click on the Save & Close preferences button
28+
Then Click on the Hamburger bar on the left panel
29+
Then Select navigation item: "studio" from the Hamburger menu list
30+
When Expand Plugin group in the LHS plugins list: "Source"
31+
When Select plugin: "BigQuery" from the plugins list as: "Source"
32+
When Expand Plugin group in the LHS plugins list: "Sink"
33+
When Select plugin: "BigQuery" from the plugins list as: "Sink"
34+
Then Connect plugins: "BigQuery" and "BigQuery2" to establish connection
35+
Then Navigate to the properties page of plugin: "BigQuery"
36+
Then Enter input plugin property: "referenceName" with value: "BQReferenceName"
37+
Then Click on the Macro button of Property: "projectId" and set the value to: "projectId"
38+
Then Click on the Macro button of Property: "datasetProjectId" and set the value to: "datasetprojectId"
39+
Then Enter input plugin property: "dataset" with value: "dataset"
40+
Then Enter input plugin property: "table" with value: "bqSourceTable"
41+
Then Validate "BigQuery" plugin properties
42+
Then Close the Plugin Properties page
43+
Then Navigate to the properties page of plugin: "BigQuery2"
44+
Then Enter input plugin property: "referenceName" with value: "BQReferenceName"
45+
Then Click on the Macro button of Property: "projectId" and set the value to: "projectId"
46+
Then Click on the Macro button of Property: "datasetProjectId" and set the value to: "datasetprojectId"
47+
Then Enter input plugin property: "dataset" with value: "dataset"
48+
Then Enter input plugin property: "table" with value: "bqSourceTable"
49+
Then Validate "BigQuery" plugin properties
50+
Then Close the Plugin Properties page
51+
Then Save the pipeline
52+
Then Deploy the pipeline
53+
Then Run the Pipeline in Runtime
54+
Then Wait till pipeline is in running state
55+
Then Open and capture logs
56+
Then Verify the pipeline status is "Succeeded"
57+
58+
@BQ_SOURCE_TEST @BQ_SINK_TEST
59+
Scenario: To verify if user is able to create a connection from namespace admin and configure it for required plugins
60+
Given Open Datafusion Project to configure pipeline
61+
Then Click on the Hamburger bar on the left panel
62+
Then Click on NameSpace Admin link from the menu
63+
Then Click "connections" tab from Configuration page for "default" Namespace
64+
Then Click on the Add Connection button
65+
Then Add connection type as "bqConnection" and provide a "ConnectionName"
66+
Then Click on the Test Connection button
67+
Then Click on the Create button
68+
Then Click on the Hamburger bar on the left panel
69+
Then Select navigation item: "studio" from the Hamburger menu list
70+
When Select plugin: "BigQuery" from the plugins list as: "Source"
71+
When Expand Plugin group in the LHS plugins list: "Sink"
72+
When Select plugin: "BigQuery" from the plugins list as: "Sink"
73+
Then Connect plugins: "BigQuery" and "BigQuery2" to establish connection
74+
Then Navigate to the properties page of plugin: "BigQuery"
75+
Then Click plugin property: "switch-useConnection"
76+
Then Click on the Browse Connections button
77+
Then Select connection: "ConnectionName"
78+
Then Enter input plugin property: "referenceName" with value: "BQReferenceName"
79+
Then Click on the Browse button inside plugin properties
80+
Then Click SELECT button inside connection data row with name: "dataset"
81+
Then Wait till connection data loading completes with a timeout of 60 seconds
82+
Then Enter input plugin property: "table" with value: "bqSourceTable"
83+
Then Validate "BigQuery" plugin properties
84+
Then Close the Plugin Properties page
85+
Then Navigate to the properties page of plugin: "BigQuery2"
86+
Then Click plugin property: "useConnection"
87+
Then Click on the Browse Connections button
88+
Then Select connection: "ConnectionName"
89+
Then Enter input plugin property: "referenceName" with value: "BQSinkReferenceName"
90+
Then Click on the Browse button inside plugin properties
91+
Then Click SELECT button inside connection data row with name: "dataset"
92+
Then Wait till connection data loading completes with a timeout of 60 seconds
93+
Then Verify input plugin property: "dataset" contains value: "dataset"
94+
Then Enter input plugin property: "table" with value: "bqTargetTable"
95+
Then Click plugin property: "truncateTable"
96+
Then Validate "BigQuery" plugin properties
97+
Then Close the Plugin Properties page
98+
Then Save the pipeline
99+
Then Deploy the pipeline
100+
Then Run the Pipeline in Runtime
101+
Then Wait till pipeline is in running state
102+
Then Open and capture logs
103+
Then Verify the pipeline status is "Succeeded"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright © 2023 Cask Data, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
17+
package io.cdap.cdap.namespaceadmin;
18+
19+
import io.cucumber.junit.Cucumber;
20+
import io.cucumber.junit.CucumberOptions;
21+
import org.junit.runner.RunWith;
22+
23+
/**
24+
* Test Runner to execute namespace admin related test cases.
25+
*/
26+
@RunWith(Cucumber.class)
27+
@CucumberOptions(
28+
features = {"src/e2e-test/features"},
29+
glue = {"io.cdap.cdap.stepsdesign", "stepsdesign"},
30+
tags = {"@NameSpaceadmin"},
31+
plugin = {"pretty", "html:target/cucumber-html-report/namespaceadmin",
32+
"json:target/cucumber-reports/cucumber-namespaceadmin.json",
33+
"junit:target/cucumber-reports/cucumber-namespaceadmin.xml"}
34+
)
35+
public class TestRunner {
36+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright © 2023 Cask Data, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
17+
/**
18+
* Package contains the runners for nameSpace admin features.
19+
*/
20+
package io.cdap.cdap.namespaceadmin;
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/*
2+
* Copyright © 2023 Cask Data, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
package io.cdap.cdap.stepsdesign;
17+
18+
import com.google.cloud.bigquery.BigQueryException;
19+
import io.cdap.e2e.utils.BigQueryClient;
20+
import io.cdap.e2e.utils.PluginPropertyUtils;
21+
import io.cucumber.java.After;
22+
import io.cucumber.java.Before;
23+
import java.io.IOException;
24+
import java.util.UUID;
25+
import org.apache.commons.lang3.StringUtils;
26+
import org.junit.Assert;
27+
import stepsdesign.BeforeActions;
28+
29+
/**
30+
* GCP test hooks.
31+
*/
32+
public class TestSetupHooks {
33+
34+
public static String bqTargetTable = StringUtils.EMPTY;
35+
public static String bqSourceTable = StringUtils.EMPTY;
36+
public static String datasetName = PluginPropertyUtils.pluginProp("dataset");
37+
38+
@Before(order = 1, value = "@BQ_SINK_TEST")
39+
public static void setTempTargetBQTableName() {
40+
bqTargetTable = "E2E_TARGET_" + UUID.randomUUID().toString().replaceAll("-", "_");
41+
PluginPropertyUtils.addPluginProp("bqTargetTable", bqTargetTable);
42+
BeforeActions.scenario.write("BQ Target table name - " + bqTargetTable);
43+
}
44+
45+
@After(order = 1, value = "@BQ_SINK_TEST")
46+
public static void deleteTempTargetBQTable() throws IOException, InterruptedException {
47+
try {
48+
BigQueryClient.dropBqQuery(bqTargetTable);
49+
PluginPropertyUtils.removePluginProp("bqTargetTable");
50+
BeforeActions.scenario.write("BQ Target table - " + bqTargetTable + " deleted successfully");
51+
bqTargetTable = StringUtils.EMPTY;
52+
} catch (BigQueryException e) {
53+
if (e.getMessage().contains("Not found: Table")) {
54+
BeforeActions.scenario.write("BQ Target Table " + bqTargetTable + " does not exist");
55+
} else {
56+
Assert.fail(e.getMessage());
57+
}
58+
}
59+
}
60+
61+
/**
62+
* Create BigQuery table with 3 columns (Id - Int, Value - Int, UID - string) containing random testdata.
63+
* Sample row:
64+
* Id | Value | UID
65+
* 22 | 968 | 245308db-6088-4db2-a933-f0eea650846a
66+
*/
67+
@Before(order = 1, value = "@BQ_SOURCE_TEST")
68+
public static void createTempSourceBQTable() throws IOException, InterruptedException {
69+
bqSourceTable = "E2E_SOURCE_" + UUID.randomUUID().toString().replaceAll("-", "_");
70+
StringBuilder records = new StringBuilder(StringUtils.EMPTY);
71+
for (int index = 2; index <= 25; index++) {
72+
records.append(" (").append(index).append(", ").append((int) (Math.random() * 1000 + 1)).append(", '")
73+
.append(UUID.randomUUID()).append("'), ");
74+
}
75+
BigQueryClient.getSoleQueryResult("create table `" + datasetName + "." + bqSourceTable + "` as " +
76+
"SELECT * FROM UNNEST([ " +
77+
" STRUCT(1 AS Id, " + ((int) (Math.random() * 1000 + 1)) + " as Value, " +
78+
"'" + UUID.randomUUID() + "' as UID), " +
79+
records +
80+
" (26, " + ((int) (Math.random() * 1000 + 1)) + ", " +
81+
"'" + UUID.randomUUID() + "') " +
82+
"])");
83+
PluginPropertyUtils.addPluginProp("bqSourceTable", bqSourceTable);
84+
BeforeActions.scenario.write("BQ source Table " + bqSourceTable + " created successfully");
85+
}
86+
87+
@After(order = 1, value = "@BQ_SOURCE_TEST")
88+
public static void deleteTempSourceBQTable() throws IOException, InterruptedException {
89+
BigQueryClient.dropBqQuery(bqSourceTable);
90+
PluginPropertyUtils.removePluginProp("bqSourceTable");
91+
BeforeActions.scenario.write("BQ source Table " + bqSourceTable + " deleted successfully");
92+
bqSourceTable = StringUtils.EMPTY;
93+
}
94+
}

0 commit comments

Comments
 (0)