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

New Test ODS-2223 #1101

Merged
merged 14 commits into from
Jan 9, 2024
Merged

Conversation

manosnoam
Copy link
Contributor

Add New Test ODS-2223:
Verify permissions set as part of Project Sharing do not override Dashboard permission.

image

Including:

  • New Keyword: Set RHODS Users Group To rhods-users
  • New Keyword: Assign Permissions To User in Project
  • New Keyword: Verify No Permissions For User
  • 'Reload Page If Project Is/Not Listed' Keyword with WHILE and Timeout
  • Fix 'Create Group' KW to apply new group only if it doesn't exist
  • Fix 'Delete Group' KW to delete the group only if it already exists
  • Add Resource ODS.robot to Permissions.resource and set Groups Variables
  • Add Users names to Suite Variables

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

Robocop found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@manosnoam manosnoam added verified This PR has been tested with Jenkins new test New test(s) added (PR will be listed in release-notes) labels Jan 7, 2024
Copy link
Contributor

github-actions bot commented Jan 7, 2024

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
393 0 0 393 100

FedeAlonso
FedeAlonso previously approved these changes Jan 8, 2024
Copy link
Contributor

@FedeAlonso FedeAlonso left a comment

Choose a reason for hiding this comment

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

LGTM

@manosnoam
Copy link
Contributor Author

Thanks @bdattoma , @FedeAlonso I resolved the requested issues, and retested:
image

Copy link

sonarqubecloud bot commented Jan 8, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

User ${USER_B} Should Not Be Allowed To Dashboard
User ${USER_C} Should Not Be Allowed To Dashboard
[Teardown] Run Keywords Set Default Access Groups Settings
... AND Set User Groups For Testing
Copy link
Contributor

@bdattoma bdattoma Jan 8, 2024

Choose a reason for hiding this comment

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

wait, why running Set User Groups For Testing in the test teardown? I think it's not needed. You don't see issues because there is the Suite Teardown which restores the default settings.

I believe you can remove the [Teardown] here and let the suite teardown to restore default user settings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it is safer to run Set User Groups For Testing in test teardown, in case the test is not the last one in suite, so if another test is called afterwards, then the expected Users are already set properly.

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm I think you could actually avoid lines 92 and 94 because those are already executed in the Suite Setup. If you want to remove the users from the rhods-admin group as well, you can also add it to the Suite Setup (and change the Suite Teardown accordingly)

Alternatively, instead of using Set RHODS Users Group To rhods-users you can do Set RHODS Users Group To ${USER_GROUP_1} and Set RHODS Users Group To ${USER_GROUP_1}. This should remove lines from 91 to 95 + 98-99

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand now why you did it as you did, it works of course. However it think it could be cleaner as I wrote in the above comment.

If you disagree, I will approve anyways

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bdattoma the Test case steps to automate say:

assign "Admin" permissions to a user B who does not belong to any RHODS user group
assign "Edit" permissions to a user C who does not belong to any RHODS user group

The existing KW Set RHODS Users Group To doesn't do that exactly, as it does not specifically make the user not part of a group. It modifies oc patch OdhDashboardConfig odh-dashboard-config, which is a slightly different scenario.
This is why I use KW Remove User From Group rhods-users and rhods-admin, which does:
oc adm groups remove-users ${group_name} ${username}

I think this is good enough for the scenario, we can later extend this scenario if needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I know, but the suite setup already removes users from group. Besides, I'm suggesting to use ${USER_GROUP_1} for both admin and basic user group because the USER_B and USER_C you're using are not part of that group.

@bdattoma
Copy link
Contributor

bdattoma commented Jan 8, 2024

LGTM, apart for my last comment, I didn't notice earlier sorry. @manosnoam

@manosnoam
Copy link
Contributor Author

manosnoam commented Jan 9, 2024 via email

@manosnoam manosnoam merged commit ac62898 into red-hat-data-services:master Jan 9, 2024
11 checks passed
@manosnoam manosnoam deleted the ods-2223 branch January 9, 2024 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new test New test(s) added (PR will be listed in release-notes) verified This PR has been tested with Jenkins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants