summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-11-16 10:51:35 +0100
committerLennart Poettering <lennart@poettering.net>2021-11-16 17:28:26 +0100
commita89b67509fb8d4f80a918f9ac93b2d759f386820 (patch)
treeabc0200b158b4f7ff88a5dac3944ffc60d8dccf6
parentc8caf53ca239d54e8412e17d227d768728558df1 (diff)
downloadsystemd-a89b67509fb8d4f80a918f9ac93b2d759f386820.tar.gz
test: add grow/shrink/minimize test for homed
Let's add testing for the stuff we just added.
-rwxr-xr-xtest/units/testsuite-46.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/units/testsuite-46.sh b/test/units/testsuite-46.sh
index fc4fc50297..6c70b32d45 100755
--- a/test/units/testsuite-46.sh
+++ b/test/units/testsuite-46.sh
@@ -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; }