slices,tests: add dhcpcd-base#884
slices,tests: add dhcpcd-base#884Meulengracht wants to merge 8 commits intocanonical:ubuntu-26.04from
Conversation
|
|
alesancor1
left a comment
There was a problem hiding this comment.
Slices LGTM, I have some comments on testing: Check below:
| essential: | ||
| - dhcpcd-base_config | ||
| - dhcpcd-base_core | ||
| - dhcpcd-base_hooks-core |
There was a problem hiding this comment.
It's included already by dhcpcd-base_hooks-standard and dhcpcd-base_core so no need to have it here:
| - dhcpcd-base_hooks-core |
| # Help output (flag differs across builds). Require at least one to succeed. | ||
| if chroot "${rootfs}" /usr/sbin/dhcpcd --help >/dev/null 2>&1; then | ||
| : | ||
| elif chroot "${rootfs}" /usr/sbin/dhcpcd -h >/dev/null 2>&1; then | ||
| : | ||
| elif chroot "${rootfs}" /usr/sbin/dhcpcd -? >/dev/null 2>&1; then | ||
| : | ||
| else | ||
| echo "dhcpcd did not accept --help/-h/-?" | ||
| exit 1 | ||
| fi |
There was a problem hiding this comment.
You need to use a different approach here, since spread will run the tests with set -e, meaning some of the if statements will cause a failure.
| summary: Integration tests for dhcpcd-base | ||
|
|
||
| execute: | | ||
| rootfs="$(install-slices dhcpcd-base_core)" |
There was a problem hiding this comment.
What about standard? We should test it, too. Feel free to use this approach
There was a problem hiding this comment.
You are only testing the existence of certain files here (appart from the -h flag). Can we add some functionality testing? Maybe a bit complex, but you can try to:
- Create a test network namespace:
ip netns add dhcp-test- Attatch a virtual eth cable (veth pair):
ip link add veth0 type veth peer name veth1
ip link set veth1 netns dhcp-test- Configure the host side:
ip addr add 10.0.0.1/24 dev veth0
ip link set veth0 up- Start a test(fake) DHCP:
dnsmasq \
--interface=veth0 \
--bind-interfaces \
--dhcp-range=10.0.0.50,10.0.0.60,12h- Bring the setup to life
ip netns exec dhcp-test ip link set lo up
ip netns exec dhcp-test ip link set veth1 up- Run dhcpcd and check an IP was assigned
ip netns exec dhcp-test chroot dhcpcd -d veth1
ip netns exec dhcp-test ip -4 addr show veth1 | grep -q "inet "Then clean up everything with something like:
pkill dnsmasq 2>/dev/null || true
ip link del veth0 2>/dev/null || true
ip netns del dhcp-test 2>/dev/null || true
Proposed changes
dhcpcd-base is required for Ubuntu Core 26
Checklist