Skip to content

MGT-1 Refactor management HA test to use timeout constant for sleep durations and simplify loss checks#5388

Open
fmolinar wants to merge 4 commits intoopenconfig:mainfrom
b4firex:mgt-1-hotfix
Open

MGT-1 Refactor management HA test to use timeout constant for sleep durations and simplify loss checks#5388
fmolinar wants to merge 4 commits intoopenconfig:mainfrom
b4firex:mgt-1-hotfix

Conversation

@fmolinar
Copy link
Copy Markdown
Contributor

No description provided.

@fmolinar fmolinar requested a review from a team as a code owner April 27, 2026 21:40
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Standardized Timeouts: Introduced a constant 'timeout' of 10 seconds to replace hardcoded sleep durations throughout the test suite.
  • Simplified Loss Checks: Refined validation logic by removing redundant frame count comparisons in favor of using flow loss percentage checks.
  • Code Cleanup: Removed unused constants and configuration parameters related to prefix handling to reduce technical debt.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@OpenConfigBot
Copy link
Copy Markdown

OpenConfigBot commented Apr 27, 2026

Pull Request Functional Test Report for #5388 / 5ed6b65

Virtual Devices

Device Test Test Documentation Job Raw Log
Arista cEOS status
MGT-1: Management HA solution test
Cisco 8000E status
MGT-1: Management HA solution test
Cisco XRd status
MGT-1: Management HA solution test
Juniper ncPTX status
MGT-1: Management HA solution test
Nokia SR Linux status
MGT-1: Management HA solution test
Openconfig Lemming status
MGT-1: Management HA solution test

Hardware Devices

Device Test Test Documentation Raw Log
Arista 7808 status
MGT-1: Management HA solution test
Cisco 8808 status
MGT-1: Management HA solution test
Juniper PTX10008 status
MGT-1: Management HA solution test
Nokia 7250 IXR-10e status
MGT-1: Management HA solution test

Help

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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
  1. In test suites, maintaining a consistent code style across similar tests is preferred, even if it means not renaming variables that shadow package names.

Comment thread feature/system/management/otg_tests/management_ha_test/management_ha_test.go Outdated
Comment thread feature/system/management/otg_tests/management_ha_test/management_ha_test.go Outdated
…ent_ha_test.go

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@fmolinar fmolinar changed the title Refactor management HA test to use timeout constant for sleep durations and simplify loss checks MGT-1 Refactor management HA test to use timeout constant for sleep durations and simplify loss checks Apr 28, 2026
fmolinar and others added 2 commits April 28, 2026 10:47
…ent_ha_test.go

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants