1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-25 18:50:18 +03:00

test: add test checking if pattern based hostnames work

This commit is contained in:
Lennart Poettering 2025-03-07 09:32:58 +01:00
parent af9c45d5b6
commit f1bc816c09

View File

@ -262,6 +262,22 @@ test_varlink() {
cmp "$A" "$B"
}
test_wildcard() {
SAVED="$(cat /etc/hostname)"
P='foo-??-??.????bar'
hostnamectl set-hostname "$P"
H="$(hostname)"
# Validate that the hostname is not the literal pattern, but matches the pattern shell style
assert_neq "$H" "$P"
[[ "$P" == "$H" ]]
assert_eq "$(cat /etc/hostname)" "$P"
assert_in "Static hostname: foo-" "$(hostnamectl)"
hostnamectl set-hostname "$SAVED"
}
run_testcases
touch /testok