Skip to content

Fixing control_card_redundancy test for Fixed chassis#5195

Closed
ram-mac wants to merge 1 commit intoopenconfig:mainfrom
ram-mac:control_red
Closed

Fixing control_card_redundancy test for Fixed chassis#5195
ram-mac wants to merge 1 commit intoopenconfig:mainfrom
ram-mac:control_red

Conversation

@ram-mac
Copy link
Copy Markdown
Contributor

@ram-mac ram-mac commented Mar 5, 2026

This tests were failing for the devices with no controller_card specifically the Fixed form factor chassis.

@ram-mac ram-mac requested a review from a team as a code owner March 5, 2026 05:36
@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 enhances the robustness of the controller_card_redundancy_test by introducing conditional skipping based on the number of detected controller cards. This prevents test failures on devices, such as fixed-form-factor chassis, that do not meet the test's assumption of exactly two controller cards, ensuring the test is only executed in relevant hardware configurations.

Highlights

  • Test Skipping Logic: Modified the TestControllerCards function to skip the test rather than error out when a device has fewer than two controller cards, specifically addressing fixed-form-factor chassis devices.
  • Expanded Test Skipping: Implemented an additional skip condition for TestControllerCards to prevent execution on devices that report more than two controller cards.
Changelog
  • feature/platform/controllercard/tests/controller_card_redundancy_test/controller_card_redundancy_test.go
    • Changed the t.Errorf call to t.Skipf when fewer than two controller cards are found, preventing test failures on devices like fixed-form-factor chassis.
    • Added a new t.Skipf condition to bypass the test if more than two controller cards are detected.
Activity
  • No specific activity (comments, reviews, progress) was provided in the context.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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

Pull Request Functional Test Report for #5195 / 15ad930

Virtual Devices

Device Test Test Documentation Job Raw Log
Arista cEOS status
gNMI-1.17: Controller card redundancy test
b20e7cc1 Log
Cisco 8000E status
gNMI-1.17: Controller card redundancy test
3bb5c863 Log
Cisco XRd status
gNMI-1.17: Controller card redundancy test
e23b299c Log
Juniper ncPTX status
gNMI-1.17: Controller card redundancy test
6e8fc3f0 Log
Nokia SR Linux status
gNMI-1.17: Controller card redundancy test
b3e8147c Log
Openconfig Lemming status
gNMI-1.17: Controller card redundancy test
286923a8 Log

Hardware Devices

Device Test Test Documentation Raw Log
Arista 7808 status
gNMI-1.17: Controller card redundancy test
Cisco 8808 status
gNMI-1.17: Controller card redundancy test
Juniper PTX10008 status
gNMI-1.17: Controller card redundancy test
Nokia 7250 IXR-10e status
gNMI-1.17: Controller card redundancy 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 correctly addresses an issue where controller card redundancy tests would fail on devices without two controller cards (e.g., fixed-form-factor chassis) by changing the failure condition to skip the test. It also adds a condition to skip the test if more than two controller cards are present, correctly scoping the test to dual-controller setups. I've suggested a minor refactoring to combine these two checks into one for improved code clarity and conciseness, in line with the repository's style guide.

Comment on lines 466 to 473
if got, want := len(controllerCards), 2; got < want {
t.Errorf("Not enough controller cards for the test on %v: got %v, want at least %v", dut.Model(), got, want)
t.Skipf("Not enough controller cards for the test on %v: got %v, want at least %v: Check the Vendor model it could be fixed form factor device", dut.Model(), got, want)
}

// Skip the test if there are more than 2 controller cards.
if len(controllerCards) > 2 {
t.Skipf("Skipping the test as there are more than 2 controller cards on %v: Check the Vendor model it could be fixed form factor device", dut.Model())
}
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

These two if statements can be combined into a single check for clarity and conciseness. Since this test is designed to run only when there are exactly two controller cards, a single condition checking for len(controllerCards) != 2 would make the intent clearer.

Suggested change
if got, want := len(controllerCards), 2; got < want {
t.Errorf("Not enough controller cards for the test on %v: got %v, want at least %v", dut.Model(), got, want)
t.Skipf("Not enough controller cards for the test on %v: got %v, want at least %v: Check the Vendor model it could be fixed form factor device", dut.Model(), got, want)
}
// Skip the test if there are more than 2 controller cards.
if len(controllerCards) > 2 {
t.Skipf("Skipping the test as there are more than 2 controller cards on %v: Check the Vendor model it could be fixed form factor device", dut.Model())
}
if len(controllerCards) != 2 {
t.Skipf("Controller card redundancy test requires exactly 2 controller cards, but got %d. Skipping test for %s.", len(controllerCards), dut.Model())
}
References
  1. The repository style guide (lines 9-13) mandates following standard Go style guides like 'Effective Go' and the 'Google Go Style Guide' to maintain readable and consistent code. Combining these two conditions into a single check improves code clarity and conciseness, aligning with these principles. (link)

@AmrNJ AmrNJ closed this Mar 11, 2026
@ram-mac ram-mac deleted the control_red branch April 17, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants