Skip to content

Commit baabc8c

Browse files
committed
New scope defined for phase 2 developement of NS admin debugging
1 parent 9089866 commit baabc8c

14 files changed

Lines changed: 243 additions & 25 deletions

File tree

cdap-e2e-tests/src/e2e-test/features/namespaceadmin/NSAdminDesignTime.feature

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Feature: NameSpaceAdmin - Validate nameSpace admin design time scenarios
2323
Then Click on NameSpace Admin link from the menu
2424
Then Click "preferences" tab from Configuration page for "default" Namespace
2525
Then Click on edit namespace preferences to set namespace preferences
26-
Then Set system preferences with key: "keyValue" and value: "systemPreferences1"
26+
Then Set nameSpace preferences with key: "keyValue" and value: "nameSpacePreferences1"
2727
Then Click on the Save & Close preferences button
2828
Then Click on edit namespace preferences to set namespace preferences
2929
Then Delete the preferences
@@ -35,7 +35,7 @@ Feature: NameSpaceAdmin - Validate nameSpace admin design time scenarios
3535
Then Click on NameSpace Admin link from the menu
3636
Then Click "preferences" tab from Configuration page for "default" Namespace
3737
Then Click on edit namespace preferences to set namespace preferences
38-
Then Set system preferences with key: "keyValue" and value: "systemPreferences2"
38+
Then Set nameSpace preferences with key: "keyValue" and value: "nameSpacePreferences2"
3939
Then Click on the Save & Close preferences button
4040
Then Click on edit namespace preferences to set namespace preferences
4141
Then Delete the preferences
@@ -48,7 +48,7 @@ Feature: NameSpaceAdmin - Validate nameSpace admin design time scenarios
4848
Then Click on NameSpace Admin link from the menu
4949
Then Click "preferences" tab from Configuration page for "default" Namespace
5050
Then Click on edit namespace preferences to set namespace preferences
51-
Then Set system preferences with key: "keyValue" and value: "systemPreferences1"
51+
Then Set nameSpace preferences with key: "keyValue" and value: "nameSpacePreferences1"
5252
Then Reset the preferences
5353
Then Verify the reset is successful for added preferences
5454

@@ -78,10 +78,22 @@ Feature: NameSpaceAdmin - Validate nameSpace admin design time scenarios
7878

7979
Scenario:To verify the validation error message with invalid namespace name
8080
Given Open Datafusion Project to configure pipeline
81-
Then Open "System Admin" menu
82-
Then Click on the Configuration link on the System admin page
83-
Then Click on Create New Namespace button
81+
Then Click on the Hamburger bar on the left panel
82+
Then Click on Namespace dropdown button
83+
Then Click on the Add Namespace tab
8484
Then Enter the New Namespace Name with value: "invalidNamespaceName"
8585
Then Enter the Namespace Description with value: "validNamespaceDescription"
8686
Then Click on: "Finish" button in the properties
87-
Then Verify the failed error message: "errorInvalidNamespace" displayed on dialog box
87+
Then Verify the failed error message: "errorInvalidNamespace" displayed on dialog box
88+
89+
Scenario: Validate user is able to create new namespace from hamburger menu and switch to newly created namespace
90+
Given Open Datafusion Project to configure pipeline
91+
Then Click on the Hamburger bar on the left panel
92+
Then Click on Namespace dropdown button
93+
Then Click on the Add Namespace tab
94+
Then Enter the New Namespace Name with value: "validNamespaceName"
95+
Then Enter the Namespace Description with value: "validNamespaceDescription"
96+
Then Click on: "Finish" button in the properties
97+
Then Switch to the newly created Namespace
98+
Then Click on the Hamburger bar on the left panel
99+
Then Verify if the switch is successful by checking the current "validNamespaceName" value
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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@NameSpaceAdminRequired
20+
Scenario:To verify user should be able to run a pipeline successfully using the NameSpace preferences created
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+
Scenario: To verify User should be able to create a test connection inside Namespace admin and use it in any of the selected plugin Property.
59+
Given Open Datafusion Project to configure pipeline
60+
Then Click on the Hamburger bar on the left panel
61+
Then Click on NameSpace Admin link from the menu
62+
Then Click "connections" tab from Configuration page for "default" Namespace

cdap-e2e-tests/src/e2e-test/features/namespaceadmin/NameSpaceAdmin.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Feature: NameSpaceAdmin - Validate system admin page flow
88
Then Click on NameSpace Admin link from the menu
99
Then Click "preferences" tab from Configuration page for "default" Namespace
1010
Then Click on edit namespace preferences to set namespace preferences
11-
Then Set system preferences with key: "keyValue" and value: "systemPreferences1"
11+
Then Set nameSpace preferences with key: "keyValue" and value: "nameSpacePreferences1"
1212
Then Click on the Save & Close preferences button
1313

1414
Scenario:Validate user is able to open compute profile page and select a provisioner
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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.common;
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 = {"@NameSpaceAdminRequired"},
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 TestRunnerRequired {
36+
37+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* Package contains the common runners.
3+
*/
4+
package io.cdap.cdap.common;

cdap-e2e-tests/src/e2e-test/java/io/cdap/cdap/namespaceadmin/runners/TestRunner.java renamed to cdap-e2e-tests/src/e2e-test/java/io/cdap/cdap/namespaceadmin/TestRunner.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,23 @@
1414
* the License.
1515
*/
1616

17-
package io.cdap.cdap.namespaceadmin.runners;
17+
package io.cdap.cdap.namespaceadmin;
1818

1919
import io.cucumber.junit.Cucumber;
2020
import io.cucumber.junit.CucumberOptions;
2121
import org.junit.runner.RunWith;
2222

2323
/**
24-
* Test Runner to execute nameSpace admin related test cases.
24+
* Test Runner to execute namespace admin related test cases.
2525
*/
2626
@RunWith(Cucumber.class)
2727
@CucumberOptions(
2828
features = {"src/e2e-test/features"},
2929
glue = {"io.cdap.cdap.namespaceadmin.stepsdesign", "stepsdesign"},
30-
tags = {"@Namespaceadmin"},
30+
tags = {"@NameSpaceadmin"},
3131
plugin = {"pretty", "html:target/cucumber-html-report/namespaceadmin",
3232
"json:target/cucumber-reports/cucumber-namespaceadmin.json",
3333
"junit:target/cucumber-reports/cucumber-namespaceadmin.xml"}
3434
)
3535
public class TestRunner {
36-
3736
}

cdap-e2e-tests/src/e2e-test/java/io/cdap/cdap/namespaceadmin/runners/package-info.java renamed to cdap-e2e-tests/src/e2e-test/java/io/cdap/cdap/namespaceadmin/package-info.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
*/
1616

1717
/**
18-
* Package contains the runners for tethering features.
18+
* Package contains the runners for system admin features.
1919
*/
20-
package io.cdap.cdap.namespaceadmin.runners;
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.stepdesign;
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+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package io.cdap.cdap.stepdesign;

cdap-e2e-tests/src/e2e-test/java/io/cdap/cdap/tethering/stepsdesign/TetheringClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,4 @@ public static void verifyDeletionOfEstablishedConn() throws Exception {
122122
}
123123
establishedConnCount = updatedEstablishedConnCount;
124124
}
125-
}
125+
}

0 commit comments

Comments
 (0)