Skip to content

slices,tests: add dhcpcd-base#884

Open
Meulengracht wants to merge 8 commits intocanonical:ubuntu-26.04from
Meulengracht:feature/dhcpcd-base
Open

slices,tests: add dhcpcd-base#884
Meulengracht wants to merge 8 commits intocanonical:ubuntu-26.04from
Meulengracht:feature/dhcpcd-base

Conversation

@Meulengracht
Copy link
Member

Proposed changes

dhcpcd-base is required for Ubuntu Core 26

Checklist

@lczyk
Copy link
Collaborator

lczyk commented Feb 2, 2026

  • blocked on ci error preparing lxd machine in test #828. working on a fix. for now cancelled the integration tests as they would never succeed and eventually time out, and they were taking up worker allocation. will re-trigger when ci is back to a working state. apologies for the inconvenience!

@lczyk lczyk added the Blocked Waiting for something external label Feb 2, 2026
@ROCKsBot ROCKsBot requested a review from a team February 3, 2026 01:41
@lczyk
Copy link
Collaborator

lczyk commented Feb 5, 2026

@lczyk lczyk removed the Blocked Waiting for something external label Feb 5, 2026
Copy link
Member

@alesancor1 alesancor1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slices LGTM, I have some comments on testing: Check below:

essential:
- dhcpcd-base_config
- dhcpcd-base_core
- dhcpcd-base_hooks-core
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's included already by dhcpcd-base_hooks-standard and dhcpcd-base_core so no need to have it here:

Suggested change
- dhcpcd-base_hooks-core

Comment on lines 10 to 20
# 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about standard? We should test it, too. Feel free to use this approach

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Create a test network namespace:
ip netns add dhcp-test
  1. Attatch a virtual eth cable (veth pair):
ip link add veth0 type veth peer name veth1
ip link set veth1 netns dhcp-test
  1. Configure the host side:
ip addr add 10.0.0.1/24 dev veth0
ip link set veth0 up
  1. Start a test(fake) DHCP:
dnsmasq \
  --interface=veth0 \
  --bind-interfaces \
  --dhcp-range=10.0.0.50,10.0.0.60,12h
  1. 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
  1. 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

@ROCKsBot ROCKsBot requested a review from a team February 8, 2026 01:41
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.

3 participants