]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: add grow/shrink/minimize test for homed 21391/head
authorLennart Poettering <lennart@poettering.net>
Tue, 16 Nov 2021 09:51:35 +0000 (10:51 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 16 Nov 2021 16:28:26 +0000 (17:28 +0100)
Let's add testing for the stuff we just added.

test/units/testsuite-46.sh

index fc4fc502979652a31c98af02a2c864635f3b3681..6c70b32d45cfee42f12d0223142e4acb73fa2cb2 100755 (executable)
@@ -69,6 +69,39 @@ inspect test-user
 PASSWORD=xEhErW0ndafV4s homectl deactivate test-user
 inspect test-user
 
+# Do some resize tests, but only if we run on real kernels, as quota inside of containers will fail
+if ! systemd-detect-virt -cq ; then
+    # grow while inactive
+    PASSWORD=xEhErW0ndafV4s homectl resize test-user 300M
+    inspect test-user
+
+    # minimize while inactive
+    PASSWORD=xEhErW0ndafV4s homectl resize test-user 0
+    inspect test-user
+
+    PASSWORD=xEhErW0ndafV4s homectl activate test-user
+    inspect test-user
+
+    # grow while active
+    PASSWORD=xEhErW0ndafV4s homectl resize test-user 300M
+    inspect test-user
+
+    # minimize while active
+    PASSWORD=xEhErW0ndafV4s homectl resize test-user 0
+    inspect test-user
+
+    # grow while active
+    PASSWORD=xEhErW0ndafV4s homectl resize test-user 300M
+    inspect test-user
+
+    # shrink to original size while active
+    PASSWORD=xEhErW0ndafV4s homectl resize test-user 256M
+    inspect test-user
+
+    PASSWORD=xEhErW0ndafV4s homectl deactivate test-user
+    inspect test-user
+fi
+
 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; }