]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: remove test-user2
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 22 Dec 2021 06:43:05 +0000 (15:43 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 22 Dec 2021 08:30:03 +0000 (17:30 +0900)
Otherwise, we cannot run the test multiple times.

test/units/testsuite-46.sh

index 3313c18167b1fd411367bb7d9beaad7d189cb21a..d0bedc63d5e2c6737ca494859bb79ca7448f1652 100755 (executable)
@@ -26,6 +26,13 @@ inspect() {
     homectl inspect --json=pretty "$USERNAME"
 }
 
+wait_for_state() {
+    for ((i=0;i<10;i++)) ; do
+        homectl inspect "$1" | grep -qF "State: $2" && break
+        sleep .5
+    done
+}
+
 systemd-analyze log-level debug
 systemd-analyze log-target console
 systemctl service-log-level systemd-homed debug
@@ -156,8 +163,16 @@ PASSWORD=xEhErW0ndafV4s homectl with test-user -- test ! -f /home/test-user/xyz
 PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz \
     && { echo 'unexpected success'; exit 1; }
 
+wait_for_state test-user inactive
 homectl remove test-user
 
+if ! systemd-detect-virt -cq ; then
+    wait_for_state test-user2 active
+    homectl deactivate test-user2
+    wait_for_state test-user2 inactive
+    homectl remove test-user2
+fi
+
 systemd-analyze log-level info
 
 echo OK >/testok