add test coverage for provision error handling [SDCICD-1752]#3227
add test coverage for provision error handling [SDCICD-1752]#3227christophermancini wants to merge 1 commit into
Conversation
|
There are test jobs defined for this repository which are not configured to run automatically. Comment |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: christophermancini The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
Extracted error handling logic into testable functions and added comprehensive unit tests to verify exit code behavior for different error scenarios. Changes: - Added Provisioner interface for dependency injection - Extracted handleProvisionError() function for isolated testing - Added runWithProvisioner() to support mocking in tests - Added comprehensive test coverage for error scenarios Tests verify correct exit codes for: - Success (exit 0) - Reserve full (exit 0 - treated as success) - OIDC config failures (exit 1) - SDCICD-1752 - IAM permission errors (exit 1) - SDCICD-1752 - Cluster timeouts (exit 1) - Health check failures (exit 1) Note: The underlying error handling logic remains unchanged from PR openshift#3122 which already correctly handles these scenarios. This commit adds tests to prevent regression and improve code maintainability. All tests passing: 7 test cases in 0.016s Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1c649de to
a949c80
Compare
|
@christophermancini: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
Adds test coverage for provision command error handling to prevent regression of the fix from PR #3122.
Relates to: SDCICD-1752
Changes
handleProvisionError()function with test coverageProvisionerinterface for dependency injectionTest Coverage
✓ Success → exit 0
✓ Reserve full → exit 0 (treated as success)
✓ OIDC failures → exit 1 (SDCICD-1752)
✓ IAM errors → exit 1 (SDCICD-1752)
✓ Cluster timeouts → exit 1
✓ Health check failures → exit 1
All tests pass in 0.016s (7 test cases)