]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-46-HOMED: homectl unregister and friends needs the target is inactive or absent 38659/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 20 Aug 2025 18:07:26 +0000 (03:07 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 21 Aug 2025 17:28:58 +0000 (02:28 +0900)
Hence, we need to wait for the previous operation finished.
Fixes the following failure:
```
TEST-46-HOMED.sh[107]: + homectl unregister signtest
TEST-46-HOMED.sh[1449]: Failed to unregister home: Home signtest is currently being used, or an operation on home signtest is currently being executed.
```

Fixes #38643

test/units/TEST-46-HOMED.sh

index 2d31c6fcb2a3b0e8b302d5d03d53f795e784b33e..12a1e3d884190e8e6bb9fc1e854e42095d3ccbc0 100755 (executable)
@@ -748,6 +748,7 @@ IDENTITY='{"userName":"signtest","storage":"directory","disposition":"regular","
 
 # Try with stripping the foreign signature first, this should just work
 echo "$IDENTITY" | homectl create -P --identity=- --seize=yes
+wait_for_state signtest inactive
 homectl remove signtest
 
 # No try again, and don't strip the signature. It will be refused.
@@ -774,6 +775,7 @@ echo "$IDENTITY" | homectl create -P --identity=- --seize=no
 PASSWORD="test" homectl with signtest true
 
 # Remove the key, and check again ,should fail now
+wait_for_state signtest inactive
 homectl remove-signing-key signtest.public
 wait_for_state signtest inactive
 (! PASSWORD="test" homectl with signtest true)
@@ -785,15 +787,17 @@ homectl list-signing-keys | grep -q local.public
 # Test unregister + adopt
 mkdir /home/elsewhere
 mv /home/signtest.homedir /home/elsewhere/
+wait_for_state signtest absent
 homectl unregister signtest
 print_public_key | homectl add-signing-key --key-name=signtest.public
 homectl adopt /home/elsewhere/signtest.homedir
 PASSWORD="test" homectl with signtest true
-wait_for_state signtest inactive
 
 # Test register
+wait_for_state signtest inactive
 homectl unregister signtest
 homectl register /home/elsewhere/signtest.homedir/.identity
+wait_for_state signtest absent
 homectl unregister signtest
 
 # Test automatic fixation for anything in /home/
@@ -801,9 +805,9 @@ mv /home/elsewhere/signtest.homedir /home
 rmdir /home/elsewhere
 wait_for_exist signtest
 PASSWORD="test" homectl with signtest true
-wait_for_state signtest inactive
 
 # add signing key via credential
+wait_for_state signtest inactive
 homectl remove-signing-key signtest.public
 (! (homectl list-signing-keys | grep -q signtest.public))
 systemd-run --wait -p "SetCredential=home.add-signing-key.signtest.public:$(print_public_key)" homectl firstboot
@@ -812,15 +816,17 @@ homectl list-signing-keys | grep -q signtest.public
 # register user via credential
 mkdir /home/elsewhere2
 mv /home/signtest.homedir /home/elsewhere2/
+wait_for_state signtest absent
 homectl unregister signtest
 systemd-run --wait -p "LoadCredential=home.register.signtest:/home/elsewhere2/signtest.homedir/.identity" homectl firstboot
 homectl inspect signtest
+wait_for_state signtest absent
 homectl unregister signtest
 mv /home/elsewhere2/signtest.homedir /home/
 rmdir /home/elsewhere2
-wait_for_exist signtest
 
 # Remove it all again
+wait_for_exist signtest
 homectl remove-signing-key signtest.public
 homectl remove signtest