Improve integration tests interface-ready waiting logic (LP: #1922126)#204
Conversation
2674505 to
3bd8f60
Compare
16a4152 to
0212e82
Compare
Codecov Report
@@ Coverage Diff @@
## master #204 +/- ##
==========================================
+ Coverage 98.92% 99.00% +0.08%
==========================================
Files 54 54
Lines 8428 8324 -104
==========================================
- Hits 8337 8241 -96
+ Misses 91 83 -8
Continue to review full report at Codecov.
|
sil2100
left a comment
There was a problem hiding this comment.
Ah, I actually forgot to approve this one earlier. So yeah, this looks good and I like this wait-logic much more than what we had previously.
|
Just curious: codecov seems to say there's less coverage this time, is that true or is it just getting confused? |
|
\o/ Thanks for the review and approval! The |
0212e82 to
8a9469b
Compare
Description
This is a big refactoring of the integration test suite, which should make it much faster and more stable in different testing environments (e.g. armhf LXD containers).
The main change is in
tests/integration/base.pyand changes the waiting logic to decide when an given interface is readily configured. Previously, we were relying on/lib/systemd/systemd-networkd-wait-onlineto tell us magically when the networking is fully configured. This does not properly work for interfaces controlled by NetworkManager and is only watching the "general" networking state (i.e. whenever the first interface is up and running).Waiting only on an arbitrary "first" network interface to be ready leads to races as we use asserts on many individual interfaces, which might not be ready at that time. So with this change the
generate_and_settle(self, wait_interfaces=None):method got a newwait_interfacesargument, where the developer needs to specify each interface to be tested in a given test case. Furthermore, the developer can wait for a specified state (i.e. DHCP4/6 address assigned), to account for waiting on asynchronous background tasks, e.g.:All existing integration tests have been adopted to specify their interfaces-under-test in
generate_and_settle(). Additionally, some logging was added to always print the name of the currently waited on interface and one dot per second (up to 60s), to see how long it takes to become ready (or times out), especially on slower architectures.Checklist
make checksuccessfully.make check-coverage).