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

Add different access level test cases in workspace update flow #1630

Merged

Conversation

wanglam
Copy link
Collaborator

@wanglam wanglam commented Nov 8, 2024

Description

This PR is for adding different access level test cases in workspace update flow

Issues Resolved

[List any issues this PR will resolve]

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Comment on lines 152 to 157
let originalUser = ADMIN_AUTH.username;
let originalPassword = ADMIN_AUTH.password;
beforeEach(() => {
originalUser = ADMIN_AUTH.username;
originalPassword = ADMIN_AUTH.password;
});
Copy link
Member

Choose a reason for hiding this comment

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

Do we actually need to update originalUser and originalPassword in before each? Shall we simply do a const

Suggested change
let originalUser = ADMIN_AUTH.username;
let originalPassword = ADMIN_AUTH.password;
beforeEach(() => {
originalUser = ADMIN_AUTH.username;
originalPassword = ADMIN_AUTH.password;
});
const originalUser = ADMIN_AUTH.username;
const originalPassword = ADMIN_AUTH.password;

@@ -4,3 +4,8 @@
*/

export const WORKSPACE_API_PREFIX = '/api/workspaces';

export const NONE_DASHBOARDS_ADMIN_USER = {
Copy link
Member

Choose a reason for hiding this comment

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

What about create internal user with command createInternalUser so the workspace tests don't rely on specific user and pass.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've tried this way before. But not only do we need to call createInternalUser, we also need to create a role and map the internal user to it too. It will be more complicated.

wanglam and others added 3 commits November 8, 2024 14:42
…boards/workspace-plugin/mds_workspace_detail.spec.js

Co-authored-by: Yulong Ruan <[email protected]>
Signed-off-by: Lin Wang <[email protected]>
Signed-off-by: Lin Wang <[email protected]>
@wanglam wanglam requested review from SuZhou-Joe and ruanyl November 13, 2024 03:04
after(() => {
cy.deleteWorkspaceById(workspaceId);
if (Cypress.env('SECURITY_ENABLED')) {
cy.deleteInternalUser(NONE_DASHBOARDS_ADMIN_USERNAME);
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we delete role and role mapping as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It won't fail when creating a role or mapping with the same name. Deleting a user is to protect the system. Will add the remove role logic.

@wanglam wanglam requested a review from yubonluo as a code owner November 20, 2024 02:43
@wanglam wanglam merged commit 7e05a4f into opensearch-project:main Nov 20, 2024
57 of 65 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Nov 20, 2024
* Add test case work different access level in workspace update

Signed-off-by: Lin Wang <[email protected]>

* Update cypress/integration/core-opensearch-dashboards/opensearch-dashboards/workspace-plugin/mds_workspace_detail.spec.js

Co-authored-by: Yulong Ruan <[email protected]>
Signed-off-by: Lin Wang <[email protected]>

* Address PR comments

Signed-off-by: Lin Wang <[email protected]>

* Replace kibanaserver with self created workspace test user

Signed-off-by: Lin Wang <[email protected]>

* Delete role after test finish

Signed-off-by: Lin Wang <[email protected]>

* Delete role mapping

Signed-off-by: Lin Wang <[email protected]>

---------

Signed-off-by: Lin Wang <[email protected]>
Signed-off-by: SuZhou-Joe <[email protected]>
Co-authored-by: Yulong Ruan <[email protected]>
Co-authored-by: SuZhou-Joe <[email protected]>
(cherry picked from commit 7e05a4f)
SuZhou-Joe pushed a commit that referenced this pull request Nov 22, 2024
#1657)

* Add test case work different access level in workspace update

Signed-off-by: Lin Wang <[email protected]>

* Update cypress/integration/core-opensearch-dashboards/opensearch-dashboards/workspace-plugin/mds_workspace_detail.spec.js

Co-authored-by: Yulong Ruan <[email protected]>
Signed-off-by: Lin Wang <[email protected]>

* Address PR comments

Signed-off-by: Lin Wang <[email protected]>

* Replace kibanaserver with self created workspace test user

Signed-off-by: Lin Wang <[email protected]>

* Delete role after test finish

Signed-off-by: Lin Wang <[email protected]>

* Delete role mapping

Signed-off-by: Lin Wang <[email protected]>

---------

Signed-off-by: Lin Wang <[email protected]>
Signed-off-by: SuZhou-Joe <[email protected]>
Co-authored-by: Yulong Ruan <[email protected]>
Co-authored-by: SuZhou-Joe <[email protected]>
(cherry picked from commit 7e05a4f)

Co-authored-by: Lin Wang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants