Skip to content

CI: autopkgtest edge cases for slow architectures and without systemd-resolved#550

Merged
slyon merged 3 commits intocanonical:mainfrom
slyon:no-sd-resolved
Apr 10, 2025
Merged

CI: autopkgtest edge cases for slow architectures and without systemd-resolved#550
slyon merged 3 commits intocanonical:mainfrom
slyon:no-sd-resolved

Conversation

@slyon
Copy link
Contributor

@slyon slyon commented Apr 8, 2025

Description

This PR contains several autopkgtest enhancements:

When a new veth device is created via iproute2 ("ip link add ..."), the kernel
assigns a MAC address. Once udev picks up the interface, it will apply systemd
"MACAddressPolicy=permanent" default policy. But as veths cannot (by nature)
have a permanent MAC, systemd-udev will create a random (but persistent) MAC,
changing the kernel MAC.

Previously we waited for 0.1 sec to (hopefully) pick up the later system-udev
MAC, but sometimes that wasn't enough, and we still got the earlier kernel MAC.

My patch drops the "time.sleep(0.1)" and instead triggers our test interfaces
and waits for settlement of those uevents via 'udevadm', to avoid race
conditions.

... Currently testing in experimental on real DebCI infrastructure.

Also including smaller timing fixes in tests for slow architectures (e.g. riscv64 or loong64) and avoiding systemd-resolved as a test-dependency of autopkgtests.

Checklist

slyon added 2 commits April 8, 2025 11:51
When systemd-resolved is not installed or active, we see this test failure
in integration tests:

======================================================================
FAIL: test_manual_addresses (__main__.TestNetworkd.test_manual_addresses)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/autopkgtest-lxc.hth3pnvn/downtmp/build.lIK/real-tree/tests/integration/ethernets.py", line 158, in test_manual_addresses
    self.assertRegex(resolv_conf, 'search.*fakesuffix')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Regex didn't match: 'search.*fakesuffix' not found in '# Generated by NetworkManager\nnameserver 2601::1\nnameserver fe80::449e:58ff:fe88:d68d%eth43\n'
@slyon
Copy link
Contributor Author

slyon commented Apr 8, 2025

It's working in Debian with systemd-resolved not enabled by default: https://salsa.debian.org/debian/netplan.io/-/merge_requests/18

When a new veth device is created via iproute2 ("ip link add ..."), the kernel
assigns a MAC address. Once udev picks up the interface, it will apply systemd
"MACAddressPolicy=permanent" default policy. But as veths cannot (by nature)
have a permanent MAC, systemd-udev will create a random (but persistent) MAC,
changing the kernel MAC.

Previously we waited for 0.1 sec to (hopefully) pick up the later system-udev
MAC, but sometimes that wasn't enough, and we still got the earlier kernel MAC,
failing certain tests cases, such as:

__main__.TestNetworkManager.test_eth_permanent_mac
__main__.TestNetworkManager.test_rename_interfaces
__main__.TestNetworkd.test_eth_permanent_mac
__main__.TestNetworkd.test_rename_interfaces

This patch drops the "time.sleep(0.1)" and instead triggers our test interfaces
and waits for settlement of those uevents via 'udevadm', to avoid race
conditions.
@slyon slyon marked this pull request as ready for review April 10, 2025 11:21
@slyon
Copy link
Contributor Author

slyon commented Apr 10, 2025

All 3 commits are passing CI & test in DebCI as part of the 1.1.2-5~exp2 upload to experimental (https://ci.debian.net/packages/n/netplan.io/). It's fixing a release-critical bug in Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1100907

@slyon slyon merged commit a2dfe29 into canonical:main Apr 10, 2025
16 checks passed
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.

1 participant