Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add Hammer support for invalidating users JWTs #17468

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

shweta83
Copy link
Contributor

Problem Statement

Hammer support for invalidating JWTs : SAT-30385

Solution

Added support for JWT invalidate in CLI

Related Issues

@shweta83 shweta83 added No-CherryPick PR doesnt need CherryPick to previous branches Stream Introduced in or relating directly to Satellite Stream/Master labels Jan 30, 2025
@shweta83 shweta83 requested a review from a team as a code owner January 30, 2025 12:14
@shweta83 shweta83 force-pushed the jwt_invalidate_hammer branch from b166c15 to 770cb4a Compare February 5, 2025 09:48
@shweta83 shweta83 requested a review from a team as a code owner February 5, 2025 09:48
@shweta83 shweta83 force-pushed the jwt_invalidate_hammer branch 3 times, most recently from 3de9987 to 3938ea8 Compare February 5, 2025 09:52
@shweta83 shweta83 requested a review from girijaasoni February 5, 2025 09:55
@shweta83 shweta83 force-pushed the jwt_invalidate_hammer branch 3 times, most recently from 09bb698 to 7c0d2de Compare February 5, 2025 10:24
@shweta83
Copy link
Contributor Author

shweta83 commented Feb 5, 2025

trigger: test-robottelo
pytest: tests/foreman/cli/test_user.py -k test_positive_invalidating_users_tokens

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 10069
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/cli/test_user.py -k test_positive_invalidating_users_tokens --external-logging
Test Result : =========== 25 deselected, 34 warnings, 1 error in 642.05s (0:10:42) ===========

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label Feb 5, 2025
@shweta83 shweta83 force-pushed the jwt_invalidate_hammer branch from 7c0d2de to 70008b4 Compare February 5, 2025 13:49
@shweta83
Copy link
Contributor Author

shweta83 commented Feb 5, 2025

trigger: test-robottelo
pytest: tests/foreman/cli/test_user.py -k test_positive_invalidating_users_tokens

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 10079
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/cli/test_user.py -k test_positive_invalidating_users_tokens --external-logging
Test Result : ========= 2 passed, 25 deselected, 134 warnings in 2358.64s (0:39:18) ==========

@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 Feb 5, 2025
@shweta83 shweta83 force-pushed the jwt_invalidate_hammer branch from 8b9b6a6 to 33e4c00 Compare February 10, 2025 13:40
@shweta83
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/cli/test_user.py -k test_positive_invalidating_users_tokens

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 10137
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/cli/test_user.py -k test_positive_invalidating_users_tokens --external-logging
Test Result : ========= 2 passed, 25 deselected, 121 warnings in 1043.88s (0:17:23) ==========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Feb 10, 2025
@shweta83 shweta83 force-pushed the jwt_invalidate_hammer branch from 33e4c00 to 8d1d61d Compare February 10, 2025 18:21
@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Feb 10, 2025
@shweta83
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/cli/test_user.py -k test_positive_invalidating_users_tokens

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 10141
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/cli/test_user.py -k test_positive_invalidating_users_tokens --external-logging
Test Result : ========= 2 passed, 25 deselected, 124 warnings in 1195.07s (0:19:55) ==========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Feb 10, 2025
@shweta83 shweta83 force-pushed the jwt_invalidate_hammer branch from 8d1d61d to 704c8a8 Compare February 13, 2025 10:50
@shweta83 shweta83 requested a review from a team as a code owner February 13, 2025 10:50
@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Feb 13, 2025
@shweta83 shweta83 force-pushed the jwt_invalidate_hammer branch from 704c8a8 to a922725 Compare February 13, 2025 10:52
@shweta83
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/cli/test_registration.py -k test_positive_invalidating_users_tokens

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 10166
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/cli/test_registration.py -k test_positive_invalidating_users_tokens --external-logging
Test Result : ========== 1 passed, 20 deselected, 33 warnings in 1077.34s (0:17:57) ==========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Feb 13, 2025
@shweta83 shweta83 force-pushed the jwt_invalidate_hammer branch from a922725 to 6ecd4e5 Compare February 14, 2025 08:40
@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Feb 14, 2025
@shweta83
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/cli/test_registration.py -k test_positive_invalidating_users_tokens

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 10181
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/cli/test_registration.py -k test_positive_invalidating_users_tokens --external-logging
Test Result : ========== 1 passed, 20 deselected, 33 warnings in 892.93s (0:14:52) ===========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Feb 14, 2025
Comment on lines +434 to +443
non_admin_user = module_target_sat.api.User(
login=gen_string('alpha'), password=password, organization=[module_org]
).create()
role = module_target_sat.cli_factory.make_role({'organization-id': module_org.id})
module_target_sat.cli_factory.add_role_permissions(
role.id,
resource_permissions={'User': {'permissions': ['edit_users']}},
)
module_target_sat.cli.User.add_role({'id': non_admin_user.id, 'role-id': role.id})
module_target_sat.cli.User.add_role({'id': non_admin_user.id, 'role': 'Register hosts'})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since we've same setup with APIs for both CLI and API tests now, so why not move this into a setup fixture?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point to improve it. I will make this change along with removal of no_container marker. I don't want to block merge of the PR because of this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On the second thought, creating a fixture just for 2 tests which are in different modules and using different interfaces for the setup doesn't make sense. The fixture calls are also heavy and if we add more such tests to it then I would consider creating a fixture.

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 will create a fixture common for all interfaces in a separate PR.

@Gauravtalreja1 Gauravtalreja1 merged commit 3ee1624 into SatelliteQE:master Feb 14, 2025
12 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
No-CherryPick PR doesnt need CherryPick to previous branches PRT-Passed Indicates that latest PRT run is passed for the PR Stream Introduced in or relating directly to Satellite Stream/Master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants