diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-09-19 09:20:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-19 09:20:03 +0200 |
commit | 86c131727079df158520fe9e88fb72c1606c85b9 (patch) | |
tree | 4e2cc67a0b751a6d341943af0f66450bcb05becc | |
parent | man: fix typo (diff) | |
parent | test: Run TEST-74-AUX-UTILS in virtual machine (diff) | |
download | systemd-86c131727079df158520fe9e88fb72c1606c85b9.tar.xz systemd-86c131727079df158520fe9e88fb72c1606c85b9.zip |
Merge pull request #34474 from DaanDeMeyer/user-group
Two integration test fixes
-rwxr-xr-x | mkosi.postinst.chroot | 7 | ||||
-rw-r--r-- | test/TEST-74-AUX-UTILS/meson.build | 1 | ||||
-rwxr-xr-x | test/units/TEST-74-AUX-UTILS.networkctl.sh | 30 |
3 files changed, 18 insertions, 20 deletions
diff --git a/mkosi.postinst.chroot b/mkosi.postinst.chroot index 1809a302bc..0d0eab93d2 100755 --- a/mkosi.postinst.chroot +++ b/mkosi.postinst.chroot @@ -3,18 +3,11 @@ set -e set -o nounset -if [[ "$DISTRIBUTION" =~ ubuntu|debian ]]; then - SUDO_GROUP=sudo -else - SUDO_GROUP=wheel -fi - useradd \ --uid 4711 \ --user-group \ --create-home \ --password "$(openssl passwd -1 testuser)" \ - --groups "$SUDO_GROUP",systemd-journal \ --shell /bin/bash \ testuser diff --git a/test/TEST-74-AUX-UTILS/meson.build b/test/TEST-74-AUX-UTILS/meson.build index 43a733ee64..668ad492ca 100644 --- a/test/TEST-74-AUX-UTILS/meson.build +++ b/test/TEST-74-AUX-UTILS/meson.build @@ -4,5 +4,6 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), 'storage': 'persistent', + 'vm' : true, }, ] diff --git a/test/units/TEST-74-AUX-UTILS.networkctl.sh b/test/units/TEST-74-AUX-UTILS.networkctl.sh index 0576d6c055..3d402a7182 100755 --- a/test/units/TEST-74-AUX-UTILS.networkctl.sh +++ b/test/units/TEST-74-AUX-UTILS.networkctl.sh @@ -21,6 +21,9 @@ at_exit() { trap at_exit EXIT +systemctl unmask systemd-networkd.service +systemctl start systemd-networkd.service + export NETWORK_NAME="10-networkctl-test-$RANDOM.network" export NETDEV_NAME="10-networkctl-test-$RANDOM.netdev" export LINK_NAME="10-networkctl-test-$RANDOM.link" @@ -75,15 +78,6 @@ cmp "+4" "/etc/systemd/network/${NETWORK_NAME}.d/test.conf" networkctl cat "$NETWORK_NAME" | grep '^# ' | cmp - <(printf '%s\n' "# /etc/systemd/network/$NETWORK_NAME" "# /etc/systemd/network/${NETWORK_NAME}.d/test.conf") -networkctl edit --stdin --runtime "$NETDEV_NAME" <<EOF -[NetDev] -Name=test2 -Kind=dummy -EOF - -networkctl cat "$NETDEV_NAME" | grep -v '^# ' | - cmp - <(printf '%s\n' "[NetDev]" "Name=test2" "Kind=dummy") - cat >"/usr/lib/systemd/network/$LINK_NAME" <<EOF [Match] OriginalName=test2 @@ -95,13 +89,23 @@ EOF SYSTEMD_LOG_LEVEL=debug EDITOR='true' script -ec 'networkctl edit "$LINK_NAME"' /dev/null cmp "/usr/lib/systemd/network/$LINK_NAME" "/etc/systemd/network/$LINK_NAME" -# Test links -systemctl unmask systemd-networkd -systemctl stop systemd-networkd +# The interface test2 does not exist, hence the below do not work. (! networkctl cat @test2) (! networkctl cat @test2:netdev) +(! networkctl cat @test2:link) +(! networkctl cat @test2:network) + +# create .netdev file at last, otherwise, the .link file will not be applied to the interface. +networkctl edit --stdin --runtime "$NETDEV_NAME" <<EOF +[NetDev] +Name=test2 +Kind=dummy +EOF + +networkctl cat "$NETDEV_NAME" | grep -v '^# ' | + cmp - <(printf '%s\n' "[NetDev]" "Name=test2" "Kind=dummy") -systemctl start systemd-networkd +# wait for the interface being created and configured. SYSTEMD_LOG_LEVEL=debug /usr/lib/systemd/systemd-networkd-wait-online -i test2:carrier --timeout 20 networkctl cat @test2:network | cmp - <(networkctl cat "$NETWORK_NAME") |