summaryrefslogtreecommitdiff
path: root/test/TEST-34-DYNAMICUSERMIGRATE/test.sh
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-06-25 10:40:16 +0200
committerLennart Poettering <lennart@poettering.net>2019-06-25 10:47:46 +0200
commit528c365658e830e91bc4182b3f7d65ad6707f653 (patch)
treea1bb5801a5561b2f850b75409ef362d98b1b37f2 /test/TEST-34-DYNAMICUSERMIGRATE/test.sh
parent2193f17c08f547598d95fb0eab2cc253bbb301e0 (diff)
downloadsystemd-528c365658e830e91bc4182b3f7d65ad6707f653.tar.gz
test: add test for DynamicUser=0 → =1 migration (and back)
Diffstat (limited to 'test/TEST-34-DYNAMICUSERMIGRATE/test.sh')
-rwxr-xr-xtest/TEST-34-DYNAMICUSERMIGRATE/test.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/TEST-34-DYNAMICUSERMIGRATE/test.sh b/test/TEST-34-DYNAMICUSERMIGRATE/test.sh
new file mode 100755
index 0000000000..8ef28b05f7
--- /dev/null
+++ b/test/TEST-34-DYNAMICUSERMIGRATE/test.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+set -e
+TEST_DESCRIPTION="test migrating state directory from DynamicUser=1 to DynamicUser=0 and back"
+
+. $TEST_BASE_DIR/test-functions
+
+test_setup() {
+ create_empty_image
+ mkdir -p $TESTDIR/root
+ mount ${LOOPDEV}p1 $TESTDIR/root
+
+ (
+ LOG_LEVEL=5
+ eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
+
+ setup_basic_environment
+
+ # mask some services that we do not want to run in these tests
+ ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service
+ ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service
+ ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service
+ ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket
+ ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service
+ ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service
+
+ # setup the testsuite service
+ cat >$initdir/etc/systemd/system/testsuite.service <<EOF
+[Unit]
+Description=Testsuite service
+
+[Service]
+ExecStart=/bin/bash -x /testsuite.sh
+Type=oneshot
+StandardOutput=tty
+StandardError=tty
+NotifyAccess=all
+EOF
+ cp testsuite.sh $initdir/
+
+ setup_testsuite
+ ) || return 1
+ setup_nspawn_root
+
+ ddebug "umount $TESTDIR/root"
+ umount $TESTDIR/root
+}
+
+do_test "$@"