Skip to content

Commit

Permalink
tests,slices: correct a couple of slices, add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Meulengracht committed Aug 30, 2024
1 parent fad5cdc commit 025479b
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 7 deletions.
13 changes: 10 additions & 3 deletions slices/netplan-generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,23 @@ essential:
- netplan-generator_copyright

slices:
data:
bins:
essential:
- libc6_libs
- libglib2.0-0t64_libs
- libnetplan1_libs
- systemd_bins
contents:
/usr/lib/netplan/PLACEHOLDER:
/usr/lib/systemd/system-generators/netplan:
/usr/libexec/netplan/generate:
/usr/lib/systemd/system-generators/netplan:

# the generator needs the folder and thus carry
# a placeholder file, it will be removed and a
# symlink to /usr/libexec/netplan/generate will
# be created in this folder
placeholder:
contents:
/usr/lib/netplan/PLACEHOLDER:

copyright:
contents:
Expand Down
8 changes: 4 additions & 4 deletions slices/netplan.io.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ slices:
- libglib2.0-0t64_libs
- libnetplan1_libs
- libsystemd0_libs
- netplan-generator_data
- netplan.io_cli
- netplan-generator_bins
- netplan.io_scripts
- python3-dbus_data
- python3-netifaces_data
- python3-netplan_data
Expand All @@ -22,12 +22,12 @@ slices:
contents:
/usr/sbin/netplan:

cli:
scripts:
contents:
/usr/share/netplan/netplan.script:
/usr/share/netplan/netplan_cli/**:

extras:
dbus-service:
contents:
/usr/libexec/netplan/netplan-dbus:
/usr/share/dbus-1/system-services/io.netplan.Netplan.service:
Expand Down
15 changes: 15 additions & 0 deletions tests/spread/integration/iproute2/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
summary: Integration tests for iproute2

execute: |
# Chisel a minimum number of slices to give us a runnable system that we can
# test in.
rootfs="$(install-slices bash_bins passwd_config base-files_base grep_bins iproute2_bins)"
# iproute2 needs dev mounted
mkdir "${rootfs}"/dev
mount --rbind /dev "${rootfs}"/dev
cp test.sh "${rootfs}/"
chroot "${rootfs}/" /test.sh
umount -l "${rootfs}"/dev
13 changes: 13 additions & 0 deletions tests/spread/integration/iproute2/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# smoketest ip commands
ip --help | grep "Usage:"

# test some basic commands and against loopback that
# we can kinda expect is there
ip link | grep "LOOPBACK,UP"
ip addr | grep "inet 127.0.0.1"
ip route | grep -E "default via [0-9\.]+"

# iproute carries many binaries
# so maybe extend as needed
19 changes: 19 additions & 0 deletions tests/spread/integration/netplan.io/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
summary: Integration tests for netplan.io

execute: |
# Chisel a minimum number of slices to give us a runnable system that we can
# test in.
rootfs="$(install-slices bash_bins coreutils_bins passwd_config base-files_base grep_bins netplan.io_bins)"
# netplan needs proc and dev mounted
mkdir "${rootfs}"/proc
mount -t proc /proc "${rootfs}"/proc
mkdir "${rootfs}"/dev
mount --rbind /dev "${rootfs}"/dev
cp test.sh "${rootfs}/"
chroot "${rootfs}/" /test.sh
umount -l "${rootfs}"/dev
umount "${rootfs}"/proc
9 changes: 9 additions & 0 deletions tests/spread/integration/netplan.io/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

# smoketest a couple of netplan commands
netplan --help | grep "Network configuration in YAML"
netplan info | grep "features"

# 'netplan generate' needs udevadm to work
# 'netplan apply' needs udevadm to work
# 'netplan status' does not properly work inside chroot

0 comments on commit 025479b

Please sign in to comment.