tests: add network test for 'Wired Connection' assumptions in Cockpit#1186
tests: add network test for 'Wired Connection' assumptions in Cockpit#1186rvykydal wants to merge 1 commit intorhinstaller:mainfrom
Conversation
Summary of ChangesHello @rvykydal, 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 network test suite by adding a dedicated test to verify the expected behavior and properties of the default 'Wired Connection' managed by NetworkManager. This ensures that Cockpit's interactions with these connections, particularly when making them persistent, are based on correct assumptions, thereby preventing potential regressions and improving stability. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
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
|
There was a problem hiding this comment.
Code Review
This pull request adds a new test to verify assumptions about the default 'Wired Connection' created by NetworkManager, which is relevant for an issue in Cockpit. The changes involve adding a new helper function and calling it from an existing test. The implementation is sound, but I've provided a suggestion to improve code clarity by removing an unnecessary variable.
There was a problem hiding this comment.
Hey - I've found 2 issues, and left some high level feedback:
- There is a small typo in the docstring (
conneciton→connection) that would be good to fix for clarity. - The hard-coded value
"3"forconnection.multi-connectis a bit opaque; consider using a named constant or adding a brief comment explaining what this value represents.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- There is a small typo in the docstring (`conneciton` → `connection`) that would be good to fix for clarity.
- The hard-coded value `"3"` for `connection.multi-connect` is a bit opaque; consider using a named constant or adding a brief comment explaining what this value represents.
## Individual Comments
### Comment 1
<location path="test/helpers/network.py" line_range="318-321" />
<code_context>
+
+ The 'Wired Connection' is created in initramfs by NM as a default
+ connection. Cockpit has some assumptions about properties of the
+ connection when replacing it with persistent conneciton upon editing
+ (COCKPIT-1750)
+ This check should assert that these assumptions hold.
</code_context>
<issue_to_address>
**nitpick (typo):** Fix typo in docstring to avoid confusion when searching for this helper
`conneciton` is misspelled; please change to `connection` to keep the documented behavior easy to read and search for.
```suggestion
The 'Wired Connection' is created in initramfs by NM as a default
connection. Cockpit has some assumptions about properties of the
connection when replacing it with persistent connection upon editing
(COCKPIT-1750)
```
</issue_to_address>
### Comment 2
<location path="test/helpers/network.py" line_range="336-339" />
<code_context>
+ # The connection is not persistent
+ n.check_con_profile_files(con_name, 1, persistent=False)
+ # The properties assumed by Cockpit
+ n.check_con_settings([
+ [con_name, "connection.interface-name", "", None],
+ [con_name, "connection.type", "802-3-ethernet", None],
+ [con_name, "connection.multi-connect", "3", None],
+ ])
</code_context>
<issue_to_address>
**suggestion:** Clarify or centralize the magic value for `connection.multi-connect` in the test
The hardcoded `"3"` for `"connection.multi-connect"` is a magic value tied to Cockpit’s contract with NM. Please either add a brief comment describing what `3` represents in NM terms, or extract it into a named constant shared across tests so future changes to NM behavior or supported values are easier to handle.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Related: COCKPIT-1750
4d13780 to
d51e711
Compare
KKoukiou
left a comment
There was a problem hiding this comment.
Does this check really belong to WebUI? Is there anything WebUI does to affect this? I don't see any UI visible data either.
The use case is specific to Anaconda (autoconnection created in initramfs on installer boot). |
Related: COCKPIT-1750