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 test for hostgroup access to non-admin user #15616

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shweta83
Copy link
Contributor

Problem Statement

Missing scenario for hostgroup access to non-admin user. BZ#2236418

Solution

Added test to verify hostgroup page is accessible to non-admin user.

Related Issues

@shweta83 shweta83 added QETestCoverage Issues and PRs relating to a Satellite bug CherryPick PR needs CherryPick to previous branches AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing 6.13.z Introduced in or relating directly to Satellite 6.13 6.14.z Introduced in or relating directly to Satellite 6.14 6.15.z Introduced in or relating directly to Satellite 6.15 labels Jul 10, 2024
@shweta83 shweta83 self-assigned this Jul 10, 2024
@shweta83 shweta83 requested a review from a team as a code owner July 10, 2024 07:42
@shweta83
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_ansible.py -k test_positive_non_admin_hostgroup_permission

@shweta83
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_ansible.py -k test_positive_non_admin_hostgroup_permission

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 7691
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_ansible.py -k test_positive_non_admin_hostgroup_permission --external-logging
Test Result : ========== 1 passed, 25 deselected, 34 warnings in 731.59s (0:12:11) ===========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Jul 10, 2024
@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 7693
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_ansible.py -k test_positive_non_admin_hostgroup_permission --external-logging
Test Result : ========== 1 passed, 25 deselected, 34 warnings in 658.54s (0:10:58) ===========

tests/foreman/ui/test_ansible.py Outdated Show resolved Hide resolved
@jameerpathan111 jameerpathan111 marked this pull request as draft August 20, 2024 14:28
@jameerpathan111
Copy link
Contributor

@shweta83 I converted pr to draft for now, please mark it ready for review once you're done with changes/addressing the comments.

@jyejare jyejare added the 6.16.z Introduced in or relating directly to Satellite 6.16 label Aug 22, 2024
@shweta83
Copy link
Contributor Author

shweta83 commented Sep 3, 2024

trigger: test-robottelo
pytest: tests/foreman/ui/test_ansible.py -k test_positive_non_admin_hostgroup_permission

@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Sep 17, 2024
@shweta83
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_ansible.py -k test_positive_create_delete_variable_with_overrides

@shweta83 shweta83 marked this pull request as ready for review September 17, 2024 12:43
@shweta83 shweta83 requested a review from a team September 17, 2024 12:43
@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 8676
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/ui/test_ansible.py -k test_positive_create_delete_variable_with_overrides --external-logging
Test Result : ========== 2 failed, 22 deselected, 62 warnings in 728.30s (0:12:08) ===========

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label Sep 17, 2024
@shweta83
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_ansible.py -k test_positive_create_delete_variable_with_overrides

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 8682
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/ui/test_ansible.py -k test_positive_create_delete_variable_with_overrides --external-logging
Test Result : ========== 2 failed, 22 deselected, 61 warnings in 738.35s (0:12:18) ===========

@amolpati30
Copy link
Contributor

trigger: test-robottelo
pytest: tests/foreman/ui/test_ansible.py -k test_positive_non_admin_hostgroup_permission

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 8709
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_ansible.py -k test_positive_non_admin_hostgroup_permission --external-logging
Test Result : ========== 1 passed, 23 deselected, 32 warnings in 913.59s (0:15:13) ===========

@Satellite-QE Satellite-QE added PRT-Passed Indicates that latest PRT run is passed for the PR and removed PRT-Failed Indicates that latest PRT run is failed for the PR labels Sep 18, 2024
@devendra104
Copy link
Member

trigger: test-robottelo
pytest: tests/foreman/ui/test_ansible.py -k test_positive_non_admin_hostgroup_permission

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 8729
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_ansible.py -k test_positive_non_admin_hostgroup_permission --external-logging
Test Result : ========== 1 passed, 23 deselected, 32 warnings in 738.61s (0:12:18) ===========

@shweta83
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_ansible.py -k test_positive_non_admin_hostgroup_permission

@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Sep 20, 2024
@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 8752
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_ansible.py -k test_positive_non_admin_hostgroup_permission --external-logging
Test Result : ========== 1 passed, 23 deselected, 32 warnings in 2328.02s (0:38:48) ==========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Sep 20, 2024
Copy link
Contributor

@shubhamsg199 shubhamsg199 left a comment

Choose a reason for hiding this comment

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

Ack, pending comments

Comment on lines +597 to +599
SELECTED_ROLE = [ansible_manager_role, tower_inventory_manager_role]
user = target_sat.api.User(
role=SELECTED_ROLE,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This could really confuse us later as we're using SELECTED_ROLE variable in tests for ansible roles, and here using it for user and roles

Suggested change
SELECTED_ROLE = [ansible_manager_role, tower_inventory_manager_role]
user = target_sat.api.User(
role=SELECTED_ROLE,
user = target_sat.api.User(
role=[ansible_manager_role, tower_inventory_manager_role],

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The variable definition can differ from test to test. This is something we can skip.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, but I'd prefer to keep it this way to avoid confusion and for consistency

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 would like to keep the original approach if it is fine with you.

Copy link
Collaborator

Choose a reason for hiding this comment

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

but why keeping unnecessary variable here which is nowhere used later :D

hg_name = target_sat.api.HostGroup(
organization=[function_org],
location=[function_location],
).create()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it'll make sense to add finalizer for hg delete too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I can add to finalizer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.13.z Introduced in or relating directly to Satellite 6.13 6.14.z Introduced in or relating directly to Satellite 6.14 6.15.z Introduced in or relating directly to Satellite 6.15 6.16.z Introduced in or relating directly to Satellite 6.16 AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing CherryPick PR needs CherryPick to previous branches PRT-Passed Indicates that latest PRT run is passed for the PR QETestCoverage Issues and PRs relating to a Satellite bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants