From a75a4148a8d8d682fd93127e5828d64d70f12c8f Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 22 Dec 2021 15:43:05 +0900 Subject: [PATCH] test: remove test-user2 Otherwise, we cannot run the test multiple times. --- test/units/testsuite-46.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/units/testsuite-46.sh b/test/units/testsuite-46.sh index 3313c18167..d0bedc63d5 100755 --- a/test/units/testsuite-46.sh +++ b/test/units/testsuite-46.sh @@ -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