forked from cdapio/cdap
-
Notifications
You must be signed in to change notification settings - Fork 3
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
addition of new sysadmin scenarios #9
Open
itsmekumari
wants to merge
1
commit into
develop
Choose a base branch
from
e2e_sysadmin_tests
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
162 changes: 162 additions & 0 deletions
162
cdap-e2e-tests/src/e2e-test/features/systemadmin/SysAdminRunTime.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,162 @@ | ||
# | ||
# 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. | ||
# | ||
|
||
@Sysadmin | ||
Feature: Sysadmin - Validate system admin page Run time scenarios | ||
|
||
@Sysadmin | ||
Scenario:To verify user should be able to create Namespace successfully in System Admin | ||
Given Open Datafusion Project to configure pipeline | ||
When Open "System Admin" menu | ||
Then Click on the Configuration link on the System admin page | ||
Then Click on Create New Namespace button | ||
Then Enter the New Namespace Name with value: "namespaceName" | ||
Then Enter the Namespace Description with value: "validNamespaceDescription" | ||
Then Click on: "Finish" button in the properties | ||
Then Verify the namespace created success message displayed on confirmation window | ||
Then Verify the created namespace: "namespaceName" is displayed in Namespace tab | ||
|
||
@SysAdminRequired | ||
Scenario:To verify User should be able to add a secure key from Make HTTP calls successfully with PUT calls | ||
Given Open Datafusion Project to configure pipeline | ||
When Open "System Admin" menu | ||
Then Click on the Configuration link on the System admin page | ||
Then Click on Make HTTP calls from the System admin configuration page | ||
Then Select request dropdown property with option value: "httpPutMethod" | ||
Then Enter input plugin property: "requestPath" with value: "secureKey" | ||
Then Enter textarea plugin property: "requestBody" with value: "bodyValue" | ||
Then Click on send button | ||
Then Verify the status code for success response | ||
|
||
@SysAdminRequired | ||
Scenario:To verify User should be able to fetch secure key from Make HTTP calls successfully with GET calls | ||
Given Open Datafusion Project to configure pipeline | ||
When Open "System Admin" menu | ||
Then Click on the Configuration link on the System admin page | ||
Then Click on Make HTTP calls from the System admin configuration page | ||
Then Select request dropdown property with option value: "httpGetMethod" | ||
Then Enter input plugin property: "requestPath" with value: "secureKey" | ||
Then Click on send button | ||
Then Verify the status code for success response | ||
|
||
@SysAdminRequired | ||
Scenario:To verify User should be able to delete secure key from Make HTTP calls successfully with DELETE calls | ||
Given Open Datafusion Project to configure pipeline | ||
When Open "System Admin" menu | ||
Then Click on the Configuration link on the System admin page | ||
Then Click on Make HTTP calls from the System admin configuration page | ||
Then Select request dropdown property with option value: "httpDeleteMethod" | ||
Then Enter input plugin property: "requestPath" with value: "secureKey" | ||
Then Click on send button | ||
Then Verify the status code for success response | ||
|
||
@BQ_SOURCE_TEST @BQ_SINK_TEST @SysAdminRequired | ||
Scenario:To verify user should be able to run a pipeline successfully using the System preferences created | ||
Given Open Datafusion Project to configure pipeline | ||
When Open "System Admin" menu | ||
Then Click on the Configuration link on the System admin page | ||
Then Select "systemPreferences" option from Configuration page | ||
Then Click on edit system preferences | ||
Then Set system preferences with key: "keyValue" and value: "systemPreferences2" | ||
Then Click on the Save & Close preferences button | ||
Then Click on the Hamburger menu on the left panel | ||
Then Select navigation item: "studio" from the Hamburger menu list | ||
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" | ||
Then Enter input plugin property: "referenceName" with value: "BQReferenceName" | ||
Then Click on the Macro button of Property: "projectId" and set the value to: "projectId" | ||
Then Click on the Macro button of Property: "datasetProjectId" and set the value to: "datasetProjectId" | ||
Then Enter input plugin property: "dataset" with value: "dataset" | ||
Then Enter input plugin property: "table" with value: "bqSourceTable" | ||
Then Validate "BigQuery" plugin properties | ||
Then Close the Plugin Properties page | ||
Then Navigate to the properties page of plugin: "BigQuery2" | ||
Then Click on the Macro button of Property: "projectId" and set the value to: "projectId" | ||
Then Click on the Macro button of Property: "datasetProjectId" and set the value to: "datasetProjectId" | ||
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: "bqSourceTable" | ||
Then Validate "BigQuery" plugin properties | ||
Then 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 Open and capture logs | ||
Then Verify the pipeline status is "Succeeded" | ||
|
||
@BQ_SOURCE_TEST @BQ_SINK_TEST @SysAdminRequired | ||
Scenario:To verify user should be able to run a pipeline successfully using the Namespace preferences created | ||
Given Open Datafusion Project to configure pipeline | ||
When Open "System Admin" menu | ||
Then Click on the Configuration link on the System admin page | ||
Then Click on Create New Namespace button | ||
Then Enter the New Namespace Name with value: "sampleNamespaceName" | ||
Then Enter the Namespace Description with value: "validNamespaceDescription" | ||
Then Click on: "Finish" button in the properties | ||
Then Verify the namespace created success message displayed on confirmation window | ||
Then Click on the switch to namespace button | ||
Then Click on the Hamburger menu on the left panel | ||
Then Select navigation item: "namespaceAdmin" from the Hamburger menu list | ||
Then Click "preferences" tab from Configuration page for "sampleNamespaceName" Namespace | ||
Then Click on edit namespace preferences to set namespace preferences | ||
Then Set system preferences with key: "keyValue" and value: "systemPreferences1" | ||
Then Click on the Save & Close preferences button | ||
Then Click on the Hamburger menu on the left panel | ||
Then Select navigation item: "studio" from the Hamburger menu list | ||
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" | ||
Then Enter input plugin property: "referenceName" with value: "BQReferenceName" | ||
Then Click on the Macro button of Property: "projectId" and set the value to: "projectId" | ||
Then Click on the Macro button of Property: "datasetProjectId" and set the value to: "datasetProjectId" | ||
Then Click on the Macro button of Property: "dataset" and set the value to: "dataset" | ||
Then Enter input plugin property: "table" with value: "bqSourceTable" | ||
Then Validate "BigQuery" plugin properties | ||
Then Close the Plugin Properties page | ||
Then Navigate to the properties page of plugin: "BigQuery2" | ||
Then Enter input plugin property: "referenceName" with value: "BQReferenceName" | ||
Then Click on the Macro button of Property: "projectId" and set the value to: "projectId" | ||
Then Click on the Macro button of Property: "datasetProjectId" and set the value to: "datasetProjectId" | ||
Then Click on the Macro button of Property: "dataset" and set the value to: "dataset" | ||
Then Enter input plugin property: "table" with value: "bqSourceTable" | ||
Then Validate "BigQuery" plugin properties | ||
Then 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 Open and capture logs | ||
Then Verify the pipeline status is "Succeeded" | ||
Then Close the pipeline logs | ||
When Open "System Admin" menu | ||
Then Click on the Configuration link on the System admin page | ||
Then Select "systemPreferences" option from Configuration page | ||
Then Click on edit system preferences | ||
Then Delete the preferences | ||
Then Delete the preferences | ||
Then Click on the Save & Close preferences button | ||
Then Click on the Hamburger menu on the left panel | ||
Then Select navigation item: "namespaceAdmin" from the Hamburger menu list | ||
Then Click "preferences" tab from Configuration page for "sampleNamespaceName" Namespace | ||
Then Click on edit namespace preferences to set namespace preferences | ||
Then Delete the preferences | ||
Then Click on the Save & Close preferences button |
36 changes: 36 additions & 0 deletions
36
cdap-e2e-tests/src/e2e-test/java/io/cdap/cdap/common/common/TestRunnerRequired.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,36 @@ | ||
/* | ||
* 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.common.common; | ||
|
||
import io.cucumber.junit.Cucumber; | ||
import io.cucumber.junit.CucumberOptions; | ||
import org.junit.runner.RunWith; | ||
|
||
/** | ||
* Test Runner to execute required test cases. Add @SysAdminRequired tag on the scenario. | ||
*/ | ||
@RunWith(Cucumber.class) | ||
@CucumberOptions( | ||
features = {"src/e2e-test/features"}, | ||
glue = {"stepsdesign", "io.cdap.cdap.common.stepsdesign"}, | ||
tags = {"@SysAdminRequired"}, | ||
plugin = {"pretty", "html:target/cucumber-html-report/required", | ||
"json:target/cucumber-reports/cucumber-required.json", | ||
"junit:target/cucumber-reports/cucumber-required.xml"}, | ||
monochrome = true | ||
) | ||
public class TestRunnerRequired { | ||
} |
4 changes: 4 additions & 0 deletions
4
cdap-e2e-tests/src/e2e-test/java/io/cdap/cdap/common/common/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,4 @@ | ||
/** | ||
* Package contains the common runners. | ||
*/ | ||
package io.cdap.cdap.common.common; |
94 changes: 94 additions & 0 deletions
94
cdap-e2e-tests/src/e2e-test/java/io/cdap/cdap/common/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,94 @@ | ||
/* | ||
* 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.common.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 java.io.IOException; | ||
import java.util.UUID; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.junit.Assert; | ||
import stepsdesign.BeforeActions; | ||
|
||
/** | ||
* GCP test hooks. | ||
*/ | ||
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_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()); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Create BigQuery table with 3 columns (Id - Int, Value - Int, UID - string) containing random testdata. | ||
* Sample row: | ||
* Id | Value | UID | ||
* 22 | 968 | 245308db-6088-4db2-a933-f0eea650846a | ||
*/ | ||
@Before(order = 1, value = "@BQ_SOURCE_TEST") | ||
public static void createTempSourceBQTable() throws IOException, InterruptedException { | ||
bqSourceTable = "E2E_SOURCE_" + UUID.randomUUID().toString().replaceAll("-", "_"); | ||
StringBuilder records = new StringBuilder(StringUtils.EMPTY); | ||
for (int index = 2; index <= 25; index++) { | ||
records.append(" (").append(index).append(", ").append((int) (Math.random() * 1000 + 1)).append(", '") | ||
.append(UUID.randomUUID()).append("'), "); | ||
} | ||
BigQueryClient.getSoleQueryResult("create table `" + datasetName + "." + bqSourceTable + "` as " + | ||
"SELECT * FROM UNNEST([ " + | ||
" STRUCT(1 AS Id, " + ((int) (Math.random() * 1000 + 1)) + " as Value, " + | ||
"'" + UUID.randomUUID() + "' as UID), " + | ||
records + | ||
" (26, " + ((int) (Math.random() * 1000 + 1)) + ", " + | ||
"'" + UUID.randomUUID() + "') " + | ||
"])"); | ||
PluginPropertyUtils.addPluginProp("bqSourceTable", bqSourceTable); | ||
BeforeActions.scenario.write("BQ source Table " + bqSourceTable + " created successfully"); | ||
} | ||
|
||
@After(order = 1, value = "@BQ_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; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
cdap-e2e-tests/src/e2e-test/java/io/cdap/cdap/common/stepsdesign/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,4 @@ | ||
/** | ||
* Package contains the stepDesign for the common features. | ||
*/ | ||
package io.cdap.cdap.common.stepsdesign; |
5 changes: 5 additions & 0 deletions
5
cdap-e2e-tests/src/e2e-test/resources/errorMessage.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,5 @@ | ||
validationResetSuccessMessage=Reset Successful | ||
errorInvalidClusterName=Unable to get credentials from the environment. Please explicitly set the account key. | ||
errorInvalidProfileName=Invalid profile ID: 6*&gjh879. Should only contain alphanumeric characters and _ or -. | ||
errorInvalidNamespace=Failed to Add namespace | ||
validationSuccessMessage=No errors found. |
7 changes: 7 additions & 0 deletions
7
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,7 @@ | ||
requestMethod=request-method-selector | ||
requestPath=request-path-input | ||
requestBody=request-body | ||
studio=pipeline-studio | ||
namespaceAdmin=project-admin | ||
projectId=project | ||
datasetProjectId=datasetProject |
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 |
---|---|---|
|
@@ -3,3 +3,13 @@ clientUrl=http://localhost:11011 | |
serverUrl=https://placeholder.com/api | ||
# command to generate token: gcloud auth print-access-token | ||
serverAccessToken=placeholder | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove space There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we are starting the properties which are added for sysadmin section line space is provided. |
||
namespaceName=TestNamespace | ||
sampleNamespaceName=sampleNamespace | ||
secureKey=namespaces/default/securekeys/mytestkey | ||
bodyValue={ "description": "Example Secure Key","data": "test123","properties": { "<property-key>": "<property-value>" } } | ||
httpPutMethod=PUT | ||
httpGetMethod=GET | ||
httpDeleteMethod=DELETE | ||
projectId=cdf-athena | ||
dataset=test_automation |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we already have a TestRunner ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we already have added TestRunner and now added the TestRunnerRequired file as well