MGT-1 Refactor management HA test to use timeout constant for sleep durations and simplify loss checks#5388
MGT-1 Refactor management HA test to use timeout constant for sleep durations and simplify loss checks#5388fmolinar wants to merge 4 commits intoopenconfig:mainfrom
Conversation
…ns and simplify loss checks
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 refactors the management HA test suite to improve maintainability and consistency. By centralizing sleep durations into a single constant and streamlining the validation logic for traffic loss, the tests become more robust and easier to adjust. Additionally, unused configuration code was pruned to simplify the test setup. 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
|
Pull Request Functional Test Report for #5388 / 5ed6b65Virtual Devices
Hardware Devices
|
There was a problem hiding this comment.
Code Review
This pull request refactors the management HA test by introducing a global timeout constant, adding descriptive logging for sleep intervals, and simplifying traffic loss validation using utility functions. The review feedback suggests improving consistency by using the timeout constant in all loss checks, correcting an inaccurate log message about port aging, and ensuring that error messages use accurate flow statistics rather than potentially stale port counters fetched before traffic has ceased.
| lossV6 := otgutils.GetFlowLossPct(t, bs.ATE.OTG(), "v6Flow", 10*time.Second) | ||
| t.Logf("Frames sent/received: got: %d, want: %d, loss: %f", framesRx, framesTx, lossV6) | ||
| if lossV6 > lossTolerance || framesRx < framesTx { | ||
| if lossV6 > lossTolerance { |
There was a problem hiding this comment.
With the simplification of the loss check, the manually fetched port counters framesRx and framesTx (lines 185-186) are now only used for the error message. However, these values are fetched before otgutils.GetFlowLossPct completes its internal wait for the flow to stop, meaning they may not accurately reflect the final state used for the loss calculation. It is recommended to use the flow counters returned by otgutils.GetFlowStats or simply report the loss percentage in the error message for consistency with other subtests (e.g., line 165).
References
- In test suites, maintaining a consistent code style across similar tests is preferred, even if it means not renaming variables that shadow package names.
…ent_ha_test.go Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…ent_ha_test.go Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
No description provided.