-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eth hotplug check cable and routable before pinging (Bugfix) #1694
base: main
Are you sure you want to change the base?
Conversation
57979a5
to
bc55608
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1694 +/- ##
==========================================
+ Coverage 48.99% 49.18% +0.19%
==========================================
Files 372 372
Lines 40321 40397 +76
Branches 6811 6826 +15
==========================================
+ Hits 19757 19871 +114
+ Misses 19842 19802 -40
- Partials 722 724 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for undertaking this big change!
I noticed you used your own retry mechanism for different functions in the script. I recommend using the retry
decorator available in checkbox-support (see comments inline below).
return (routable, state) | ||
|
||
|
||
def wait_for_routable_state( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should check the retry
helper decorator available in checkbox-support. (you can check how it's used here for instance). This decorator was written to prevent multiple implementations of a retry mechanism in our different test scripts.
(and we provide a mock_retry
object for writing unit tests, see the different examples available in the repo)
@@ -17,6 +126,47 @@ def has_cable(iface): | |||
return carrier.read()[0] == "1" | |||
|
|||
|
|||
def wait_for_cable_state(iface, do_cable=True, max_wait=30): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, using the retry
decorator would be better.
except sp.CalledProcessError as e: | ||
print("Error running {} command: {}".format(renderer, e)) | ||
return info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a case where you would want to return an empty dictionary and keep executing the script, even though the command returned something wrong?
Wouldn't it be better to just let the CalledProcessError
exception bubble up?
Description
Some of the machines (most of the IOT devices) can't ping after plugging the eth cable.
Some of the machines (most of the PC devices) can ping after plugging the eth cable.
In Desktop image, the networking renderer is Networkmanager
It will delay to turn down the eth interface and keep the ip (will not send req to DHCP to get the IP) when unpluggin the cable.
In Server/UC image, the networking renderer is systemd-networkd
It will immediatly turn the interface down when unplugging the cable.
Change
Need to make sure the networking renderer actually not routable if remove the cable; it actually routable if reconnect the cable before ping.
Flow
1, Check interface cable state (make sure this eth interface is existed)
2. Ask Tester to remove the eth cable
3. check cable is remove
4. check network renderer is Not routable
5. Ask Tester to reconnect the eth cable
6. check cable is connect
7. check network renderer is routable
8. Ping the gateway
Resolved issues
#1197 ethernet/hotplug-{{ interface }} fails without potential latency
#1260 ethernet/hotplug-.* failed due to unable to ping the host
Tests
PC Desktop image with NetworkManager: https://certification.canonical.com/hardware/202411-35941/submission/409179/
IOT UC image with systemd-networkd: https://certification.canonical.com/hardware/202307-31859/submission/409181/