1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

test: drop Disk (Size|Free|Floor|Ceiling) fields prior comparing

The disk attributes can take some time to update on certain filesystems,
so let's strip them from inputs of both `homectl` and `userdbctl` before
comparing them to avoid unexpected fails.

Also, switch from `cmp` to `diff` to make a potential test fail a bit more
debuggable.

Fixes: #14755
This commit is contained in:
Frantisek Sumsal 2020-04-19 16:20:03 +02:00 committed by Lennart Poettering
parent c5ca6d9076
commit ff3518f1f4

View File

@ -9,9 +9,16 @@ if ! test -x /usr/bin/homectl ; then
fi
inspect() {
# As updating disk-size-related attributes can take some time on
# some filesystems, let's drop these fields before comparing the
# outputs to avoid unexpected fails. To see the full outputs of both
# homectl & userdbctl (for debugging purposes) drop the fields just
# before the comparison.
homectl inspect $1 | tee /tmp/a
userdbctl user $1 | tee /tmp/b
cmp /tmp/a /tmp/b
local PATTERN='/^\s*Disk (Size|Free|Floor|Ceiling):/d'
diff <(sed -r "$PATTERN" /tmp/a) <(sed -r "$PATTERN" /tmp/b)
rm /tmp/a /tmp/b
}