-
Notifications
You must be signed in to change notification settings - Fork 67
test(e2e): add comprehensive e2e tests for rh-identity authentication #1045
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
base: main
Are you sure you want to change the base?
Conversation
Add configuration files for e2e testing with rh-identity authentication module enabled for both server-mode and library-mode deployments. Both configs require the 'rhel' entitlement for validation testing. Signed-off-by: Major Hayden <major@redhat.com>
Add step definitions to set x-rh-identity headers in various formats: - Raw string values (for invalid base64 testing) - Base64-encoded raw strings (for invalid JSON testing) - Base64-encoded JSON objects - Valid User identity with configurable fields - Valid System identity with configurable fields Includes helper function to encode identity data to base64. Signed-off-by: Major Hayden <major@redhat.com>
Register @RHIdentity tag in before_feature and after_feature hooks to switch configuration to rh-identity auth mode during feature execution and restore the original configuration afterwards. Signed-off-by: Major Hayden <major@redhat.com>
Add comprehensive e2e test scenarios covering all validation paths in the rh-identity authentication module: - Missing x-rh-identity header (401) - Invalid base64 encoding (400) - Invalid JSON content (400) - Missing/null identity field (400) - Missing identity type field (400) - Unsupported identity type (400) - User identity: missing user field (400) - User identity: missing user_id (400) - User identity: missing username (400) - System identity: missing system field (400) - System identity: missing cn (400) - System identity: missing account_number (400) - Missing required entitlements (403) - Empty entitlements (403) - Entitlement with is_entitled=false (403) - Valid User identity with entitlements (200) - Valid System identity with entitlements (200) Signed-off-by: Major Hayden <major@redhat.com>
WalkthroughAdds end-to-end RH Identity authentication tests and mode-specific configs, plus test harness hooks and step implementations to set and validate Changes
Sequence Diagram(s)(omitted — changes are test/config additions and do not introduce new multi-component runtime control flow requiring visualization) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…y tests
The behave step 'body of the response contains {substring}' captures
the literal text after 'contains', including any quotes. The test
assertions were failing because they searched for quoted substrings
like '"Invalid base64 encoding"' instead of unquoted text that
actually exists in the JSON response body.
Fixes 6 failing test scenarios:
- Invalid base64 encoding detection
- Invalid JSON detection
- Unsupported identity type detection
- Missing required entitlement detection (3 scenarios)
Signed-off-by: Major Hayden <major@redhat.com>
Description
Add comprehensive end-to-end tests for the
rh-identityauthentication module. These tests cover all validation paths insrc/authentication/rh_identity.py, ensuring proper error handling for malformed headers, missing fields, and entitlement validation.Test Scenarios (17 total)
Header-level validation:
Identity structure validation:
User identity validation:
System identity validation:
Entitlement validation:
Success cases:
Type of change
Tools used to create PR
Related Tickets & Documents
Checklist before requesting a review
Testing
Run the e2e tests with rh-identity feature:
Or run all e2e tests:
All 17 scenarios should pass, validating each error path and success case in the rh-identity authentication module.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.