Fixing control_card_redundancy test for Fixed chassis#5195
Fixing control_card_redundancy test for Fixed chassis#5195ram-mac wants to merge 1 commit intoopenconfig:mainfrom
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 enhances the robustness of the Highlights
Changelog
Activity
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. 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
|
Pull Request Functional Test Report for #5195 / 15ad930Virtual Devices
Hardware Devices
|
There was a problem hiding this comment.
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.
| 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()) | ||
| } |
There was a problem hiding this comment.
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.
| 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
- 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)
This tests were failing for the devices with no controller_card specifically the Fixed form factor chassis.