Skip to content

Commit 83c89fe

Browse files
committed
tests,slices: correct a couple of slices, add tests
1 parent c4c949a commit 83c89fe

File tree

6 files changed

+70
-7
lines changed

6 files changed

+70
-7
lines changed

slices/netplan-generator.yaml

+10-3
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,23 @@ essential:
44
- netplan-generator_copyright
55

66
slices:
7-
data:
7+
bins:
88
essential:
99
- libc6_libs
1010
- libglib2.0-0t64_libs
1111
- libnetplan1_libs
1212
- systemd_bins
1313
contents:
14-
/usr/lib/netplan/PLACEHOLDER:
15-
/usr/lib/systemd/system-generators/netplan:
1614
/usr/libexec/netplan/generate:
15+
/usr/lib/systemd/system-generators/netplan:
16+
17+
# the generator needs the folder and thus carry
18+
# a placeholder file, it will be removed and a
19+
# symlink to /usr/libexec/netplan/generate will
20+
# be created in this folder
21+
placeholder:
22+
contents:
23+
/usr/lib/netplan/PLACEHOLDER:
1724

1825
copyright:
1926
contents:

slices/netplan.io.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ slices:
1111
- libglib2.0-0t64_libs
1212
- libnetplan1_libs
1313
- libsystemd0_libs
14-
- netplan-generator_data
15-
- netplan.io_cli
14+
- netplan-generator_bins
15+
- netplan.io_scripts
1616
- python3-dbus_data
1717
- python3-netifaces_data
1818
- python3-netplan_data
@@ -22,12 +22,12 @@ slices:
2222
contents:
2323
/usr/sbin/netplan:
2424

25-
cli:
25+
scripts:
2626
contents:
2727
/usr/share/netplan/netplan.script:
2828
/usr/share/netplan/netplan_cli/**:
2929

30-
extras:
30+
dbus-service:
3131
contents:
3232
/usr/libexec/netplan/netplan-dbus:
3333
/usr/share/dbus-1/system-services/io.netplan.Netplan.service:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
summary: Integration tests for iproute2
2+
3+
execute: |
4+
# Chisel a minimum number of slices to give us a runnable system that we can
5+
# test in.
6+
rootfs="$(install-slices bash_bins passwd_config base-files_base grep_bins iproute2_bins)"
7+
8+
# iproute2 needs dev mounted
9+
mkdir "${rootfs}"/dev
10+
mount --rbind /dev "${rootfs}"/dev
11+
12+
cp test.sh "${rootfs}/"
13+
chroot "${rootfs}/" /test.sh
14+
15+
umount -l "${rootfs}"/dev
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
# smoketest ip commands
4+
ip --help | grep "Usage:"
5+
6+
# test some basic commands and against loopback that
7+
# we can kinda expect is there
8+
ip link | grep "LOOPBACK,UP"
9+
ip addr | grep "inet 127.0.0.1"
10+
ip route | grep -E "default via [0-9\.]+"
11+
12+
# iproute carries many binaries
13+
# so maybe extend as needed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
summary: Integration tests for netplan.io
2+
3+
execute: |
4+
# Chisel a minimum number of slices to give us a runnable system that we can
5+
# test in.
6+
rootfs="$(install-slices bash_bins coreutils_bins passwd_config base-files_base grep_bins netplan.io_bins)"
7+
8+
# netplan needs proc and dev mounted
9+
mkdir "${rootfs}"/proc
10+
mount -t proc /proc "${rootfs}"/proc
11+
12+
mkdir "${rootfs}"/dev
13+
mount --rbind /dev "${rootfs}"/dev
14+
15+
cp test.sh "${rootfs}/"
16+
chroot "${rootfs}/" /test.sh
17+
18+
umount -l "${rootfs}"/dev
19+
umount "${rootfs}"/proc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
# smoketest a couple of netplan commands
4+
netplan --help | grep "Network configuration in YAML"
5+
netplan info | grep "features"
6+
7+
# 'netplan generate' needs udevadm to work
8+
# 'netplan apply' needs udevadm to work
9+
# 'netplan status' does not properly work inside chroot

0 commit comments

Comments
 (0)