T-BC tests#205
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly expands the conformance test suite by introducing detailed scenarios for Telco Boundary Clock (T-BC) operation, including its behavior during various holdover states and re-synchronization. It also enhances the test framework's configurability with a new environment variable for E810 plugin settings and improves the robustness of PTP-related helper functions and logging mechanisms. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
/gemini review |
6aeac45 to
df837a3
Compare
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
2f9803d to
2323d1f
Compare
2323d1f to
908a070
Compare
908a070 to
64cda6e
Compare
64cda6e to
a90361e
Compare
a90361e to
0b2f30a
Compare
c06463b to
6bc2b70
Compare
sebsoto
left a comment
There was a problem hiding this comment.
Submitting this now because I'm taking too long :P
Still trying to wrap my head around the actual logic being introduced here, would appreciate someone else's review as well.
6bc2b70 to
bc9e4b5
Compare
|
@nocturnalastro changes LGTM |
e944bf6 to
593c96e
Compare
593c96e to
184453a
Compare
|
Warning Review limit reached
More reviews will be available in 37 minutes and 4 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?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 credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. 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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
WalkthroughThis PR adds end-to-end test support for the Telco Boundary Clock (T-BC) PTP mode. It introduces a new ChangesTelco Boundary Clock test support
Sequence Diagram(s)sequenceDiagram
rect rgba(135, 100, 200, 0.5)
Note over HoldoverTest,ClockClassSeq: T-BC Holdover Transition Test
end
participant HoldoverTest as Holdover Test
participant ApplyE810PluginMutation as ApplyE810PluginMutation
participant PMCMonitor as pmc.Monitor
participant UpstreamIface as Upstream Interface
participant ClockClassSeq as Clock-class Verifier
HoldoverTest->>ApplyE810PluginMutation: mutate e810 holdover settings (offset, timeout, maxInSpec)
ApplyE810PluginMutation-->>HoldoverTest: cleanup func
HoldoverTest->>PMCMonitor: NewMonitor(pod, configFile, interval)
HoldoverTest->>PMCMonitor: Start() → DataChan
loop Locked state wait
PMCMonitor-->>HoldoverTest: AnnounceData (ClockClass=6)
end
HoldoverTest->>HoldoverTest: CheckSame TT vs TR AnnounceData
HoldoverTest->>UpstreamIface: disable upstream slave interfaces
loop Holdover/out-of-spec/freerun transitions
PMCMonitor-->>HoldoverTest: AnnounceData (ClockClass 135, 165, 248)
ClockClassSeq->>ClockClassSeq: assert ordered transitions 6→135→165→248
end
HoldoverTest->>UpstreamIface: re-enable upstream interfaces
loop Re-lock wait
PMCMonitor-->>HoldoverTest: AnnounceData (ClockClass=6)
ClockClassSeq->>ClockClassSeq: assert re-lock (248→6)
end
HoldoverTest->>ApplyE810PluginMutation: cleanup (restore original PtpConfig)
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 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/conformance/serial/ptp.go`:
- Around line 2877-2878: The calls to QualifyProfileName for the TBC profile
names are incorrectly prefixed with leading underscores. Since
QualifyProfileName already appends an underscore after the configuration name
(crName + "_"), passing "_tbc-tt" and "_tbc-tr" creates double underscores in
the qualified names. Remove the leading underscores from both arguments to
QualifyProfileName at lines 2877-2878, changing them to "tbc-tt" and "tbc-tr"
respectively, to match the actual profile names and align with the correct usage
patterns found elsewhere in the code.
- Around line 547-557: The regex pattern containing the alternation `(r|t)` for
matching both `tbc-tr` and `tbc-tt` is being passed with `isLiteralText=true` to
the GetPodLogsRegex function call within the TelcoBoundaryClock conditional
block. This causes the pattern to be escaped by regexp.QuoteMeta, converting the
regex operators to literal characters and preventing the alternation from
working. Change the `isLiteralText` parameter from `true` to `false` in the
GetPodLogsRegex call for the TBC profile pattern so the regex alternation is
properly interpreted.
In `@test/pkg/ptphelper/ptphelper.go`:
- Around line 400-407: The mutateE810PluginSettings function searches for a
profile by name in a loop and uses the index variable to track its position, but
if no matching profile is found, index remains at its initialized value of 0,
causing the function to silently mutate the first profile instead of the
intended one. After the loop that searches through config.Spec.Profile, add a
check to verify whether a matching profile was actually found; if no profile
matches the profileName, either return early from the function or log a warning
to prevent unintended mutation of the wrong profile.
- Around line 517-537: The function GetConfigForProfileFromVarRun is prepending
`#profile:\s*` to the profileRegex parameter when compiling the regex pattern,
but callers like GetConfigForProfile and GetProfileLogID are already including
`#profile:\s*` in their arguments, creating a malformed double prefix pattern.
Remove the `#profile:\s*` prefix from the fmt.Sprintf call inside
GetConfigForProfileFromVarRun so it only uses the profileRegex as-is, then
update the callers GetConfigForProfile (line 505) and GetProfileLogID (line 116)
to pass the complete pattern including `#profile:\s*` when invoking
GetConfigForProfileFromVarRun.
In `@test/pkg/testconfig/testconfig_test.go`:
- Around line 306-318: The TelcoBoundaryClock test case currently builds a
single profile with a base config name, but downstream Telco logic expects two
qualified dual profiles with suffixes _tbc-tr and _tbc-tt. Refactor the test
setup in the TelcoBoundaryClock case to create two separate profile
configurations instead of one, where each profile is named with the appropriate
qualified suffix and configured with the relevant settings using the existing
helper functions like generateTelcoBCConfig, generateTs2phcConfig, and
mockTelcoBCPlugins to ensure the mock properly models the expected Telco
contract.
In `@test/pkg/testconfig/testconfig.go`:
- Line 1009: The `plugins` variable is initialized with an empty map at line
1009 but is immediately overwritten with another assignment, making the initial
initialization ineffectual and triggering linter warnings. Remove the line that
initializes `plugins := make(map[string]*apiextensions.JSON)` at line 1009.
Apply the same fix at line 1183 where an identical ineffectual initialization of
`plugins` occurs.
- Around line 2194-2216: The T-BC detection logic sets
GlobalConfig.PtpModeDiscovered to TelcoBoundaryClock but does not prevent
subsequent generic detection logic in the function from overwriting this value.
Add a guard condition or return statement after the successful T-BC detection
block (where GlobalConfig.PtpModeDiscovered is set to TelcoBoundaryClock) to
prevent the code from continuing to execute other mode classification logic that
could overwrite the detected mode. This ensures T-BC detection is not
order-dependent and the discovered mode is not inadvertently overwritten by
later detection attempts.
🪄 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
Run ID: ba98a557-70fb-415c-9300-25d42363aff5
📒 Files selected for processing (12)
Makefiletest/README.mdtest/conformance/serial/ptp.gotest/pkg/clean/clean.gotest/pkg/consts.gotest/pkg/logging/collector.gotest/pkg/metrics/metrics.gotest/pkg/pmc/pmc.gotest/pkg/ptphelper/ptphelper.gotest/pkg/ptptesthelper/ptptesthelper.gotest/pkg/testconfig/testconfig.gotest/pkg/testconfig/testconfig_test.go
184453a to
ea949c6
Compare
Add Telco Boundary Clock (T-BC) test mode with full CI test coverage: - New PTP test mode TelcoBoundaryClock with ptp4l receiver (tbc-tr) and transmitter (tbc-tt) profiles, ts2phc and E810 plugin configuration - Use qualified daemon profile names (<configname>_tbc-tr / <configname>_tbc-tt) for log-regex checks and PMC monitor/query calls - PMC monitoring package (test/pkg/pmc) for polling PTP announce data and verifying clock quality passthrough - T-BC holdover test verifying clock class transitions (6 -> 135 -> 165 -> 248) under cable-pull conditions with configurable thresholds - Announce field comparison between receiver and transmitter profiles - DisableSlaveInterfaces helper for multi-interface outage simulation - GetProfileLogID fallback via /var/run config paths - MutateE810PluginSettings for dynamic holdover threshold injection - GetConfigForProfile, GetWPCEnabledInterfaceNames, GetInterfacesByPHCAndPins, GetLeadingInterfaceForSlavePHC helpers - MaxInSpecOffsetNs environment variable support - Updated test README with new environment variables - T-BC specific test mock generators and PTPWPCTBCPolicyName constant Assisted-by: Cursor
The update-env-yaml Makefile target included KUBE_RBAC_PROXY_IMAGE in its guard condition but had no sed block to actually replace the value in config/manager/env.yaml. This meant passing KUBE_RBAC_PROXY_IMAGE to make had no effect, leaving the default placeholder image (quay.io/openshift/origin-kube-rbac-proxy:4.22) which may not be pullable, causing the linuxptp-daemon DaemonSet pods to get stuck in ImagePullBackOff. Generated-by: Cursor
ea949c6 to
91b7e0b
Compare
|
/lgtm |
Summary by CodeRabbit
New Features
Improvements
KUBE_RBAC_PROXY_IMAGEinto generated manager env configurationDocumentation
MAX_IN_SPEC_OFFSET_NSin test environment variablesTests