OCPBUGS-100388: Fix project name collision in test framework - #31464
OCPBUGS-100388: Fix project name collision in test framework#31464redhat-chai-bot wants to merge 2 commits into
Conversation
Add retry-on-AlreadyExists logic to setupProject() and setupNamespace() in the test framework. When Ginkgo parallel workers start at the same nanosecond, the PRNG produces identical names causing AlreadyExists errors. On collision, generate a new name and retry up to 3 attempts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@redhat-chai-bot: This pull request references Jira Issue OCPBUGS-98468, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions 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 openshift-eng/jira-lifecycle-plugin repository. |
|
Pipeline controller notification For optional jobs, comment This repository is configured in: automatic mode |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughProject and namespace creation retry up to three times when generated names already exist. Each retry generates updated names and related metadata. Other errors stop immediately. ChangesCreation Retry Handling
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 14 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (14 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: redhat-chai-bot The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/extended/util/client.go`:
- Around line 370-372: Update the retry bounds in test/extended/util/client.go
at lines 370-372 and 503-506 so both create flows allow the initial attempt plus
three retries. In the associated name-regeneration logic, stop generating a new
name after the final permitted retry fails.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 5ab06fee-a926-4810-896b-70d72f01ae29
📒 Files selected for processing (1)
test/extended/util/client.go
|
@redhat-chai-bot: This pull request references Jira Issue OCPBUGS-100388, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions 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 openshift-eng/jira-lifecycle-plugin repository. |
|
/jira refresh |
|
@redhat-chai-bot: This pull request references Jira Issue OCPBUGS-100388, which is invalid:
Comment DetailsIn response to this:
Instructions 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 openshift-eng/jira-lifecycle-plugin repository. |
|
Scheduling required tests: |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/jira refresh |
|
@redhat-chai-bot: This pull request references Jira Issue OCPBUGS-100388, which is invalid:
Comment DetailsIn response to this:
Instructions 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 openshift-eng/jira-lifecycle-plugin repository. |
|
Scheduling required tests: |
|
/retest-required |
1 similar comment
|
/retest-required |
|
@redhat-chai-bot: 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
Add retry-on-AlreadyExists logic to
setupProject()andsetupNamespace()intest/extended/util/client.go.Problem
When Ginkgo runs tests in parallel, each worker is a separate process that initializes
k8s.io/apimachinery/pkg/util/randwithtime.Now().UnixNano(). Workers starting at the same nanosecond get the same PRNG seed and generate identical project/namespace names, causing409 AlreadyExistserrors that immediately fail the test.This affects multiple teams across all platforms. In a recent 48-hour window, 7 distinct jobs across Metal, GCP, Azure, and AWS hit this collision with different BaseNames (
oc-adm-must-gather,server-side-apply,cloud-controller-manager,job-names,scheduling-pod-check).Fix
On
AlreadyExistserror during project/namespace creation:names.SimpleNameGenerator.GenerateName()This pattern already exists in the same file for
CreateUser()(line ~1200) which handlesapierrors.IsAlreadyExists.Non-AlreadyExists errors still fail immediately through the existing Gomega assertion.
Testing
go build ./test/extended/util/...passesgo vet ./test/extended/util/...passes@stbenjam requested in Slack thread
Summary by CodeRabbit