OCPBUGS-85436: Replace deprecated rand.Seed with pattern-based test assertions#534
OCPBUGS-85436: Replace deprecated rand.Seed with pattern-based test assertions#534kunalmemane wants to merge 1 commit into
Conversation
Signed-off-by: Kunal Memane <kmemane@redhat.com>
|
@kunalmemane: This pull request references Jira Issue OCPBUGS-85436, 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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
WalkthroughTest assertions for build-tag and container-name formatting are refactored from exact string matching to regex-based pattern validation, with import adjustments to support regular expression matching. ChangesBuild-Tag and Container-Name Test Validation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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. Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: kunalmemane 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 |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@kunalmemane: 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. |
|
/hold |
Summary
rand.Seed(0)calls fromTestRandomBuildTag,TestRandomBuildTagNoDupes, andTestContainerNamemath/randimport in favor ofregexpWhy
rand.Seed()is deprecated since Go 1.20. The old tests relied on seeding the global PRNG to get deterministic output, then asserting exact hex values. This was fragile and tested PRNG internals rather than actual function behavior.Test plan
TestRandomBuildTagpasses — checks short name prefix and format, long name SHA1 hashing and 255-char limitTestRandomBuildTagNoDupespasses — 100 calls produce unique tagsTestContainerNamepasses — output matches expected format patternSummary by CodeRabbit