feat: Data race checker - #1025
Conversation
|
Warning Review limit reached
Next review available in: 28 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe default settings add configurable Kubernetes label selectors for data-race detection. Pytest now records session timing, collects matching ChangesData race reporting
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant PytestSession
participant Settings
participant Oc
participant PodLogs
PytestSession->>Settings: Read data_race configuration
PytestSession->>Oc: Query pods by configured label selectors
Oc->>PodLogs: Fetch logs with optional elapsed-time limit
PodLogs-->>PytestSession: Return DATA RACE lines
PytestSession->>PytestSession: Print Pod Log Error Summary
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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 |
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 `@testsuite/tests/conftest.py`:
- Around line 478-482: Update _fetch_pod_errors() to catch the expected
OpenShiftPythonException around each system_project.do_action() call, continue
processing subsequent labels when a selector matches no pods, and preserve
findings already collected. Keep pytest_terminal_summary()’s final handler
narrowed to the concrete OpenShift exception raised by oc.invoke(), while
including the exception details in its error reporting.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d2f52301-88a5-4188-ba64-30e6e2b9f9c2
📒 Files selected for processing (2)
config/settings.yamltestsuite/tests/conftest.py
Signed-off-by: DaliborD45 <dalibordetko@gmail.com>
Signed-off-by: DaliborD45 <dalibordetko@gmail.com>
Signed-off-by: DaliborD45 <dalibordetko@gmail.com>
Signed-off-by: DaliborD45 <dalibordetko@gmail.com>
906fe20 to
dacfa8d
Compare
azgabur
left a comment
There was a problem hiding this comment.
Note, good hook place for collecting the logs https://docs.pytest.org/en/stable/reference/reference.html#pytest.hookspec.pytest_sessionfinish
| log_level: "debug" | ||
| data_race: | ||
| enabled: false | ||
| labels: # verify these match the actual pod labels in your cluster |
There was a problem hiding this comment.
authorino-operator missing, I suggest using label control-plane=authorino-operator
| if not settings["data_race"]["enabled"]: | ||
| return | ||
| config.data_race_start_time = time.time() |
There was a problem hiding this comment.
I would flip the logic so if someone else wants to add new code here its easier
| if not settings["data_race"]["enabled"]: | |
| return | |
| config.data_race_start_time = time.time() | |
| if settings["data_race"]["enabled"]: | |
| config.data_race_start_time = time.time() |
| for label in labels: | ||
| cmd = ["logs", "-l", label, "--all-containers", "--prefix", "--tail=-1"] | ||
| if since_seconds is not None: | ||
| cmd.append(f"--since={since_seconds}s") |
There was a problem hiding this comment.
Using --since-time would be more accurate
|
|
||
| for line in lines: | ||
| if "DATA RACE" in line: | ||
| matches.append(line) |
There was a problem hiding this comment.
Append whole data race log, not just the header
Description
This feature introduces new function that checks for DATA RACE string in the logs of pods, that are written in the config file. If it finds match, it will output to the terminal.
Changes
testsuite/tests/conftest.py:pytest_configurehook records the session start time when data race detection is enabled_fetch_pod_errors()helper iterates over configured pod labels in thekuadrant-systemnamespace and collects log lines containingDATA RACEpytest_terminal_summaryhook fetches pod logs scoped to the session duration and prints a summary of any data race findingsconfig/settings.yaml:data_racesection withenabledflag and configurablelabelslist targeting Authorino, Limitador, DNS operator, and Kuadrant controller podsVerification steps
data_race.enabled: trueinconfig/settings.local.yamlmake kuadrant) and verify the terminal summary section appears at the end:Summary by CodeRabbit
New Features
Bug Fixes