summaryrefslogtreecommitdiffstats
path: root/debian/tests/hostnamed
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:35:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:35:19 +0000
commitb7e8d5af06ee840cc48217ca4629cf28aeeb3c50 (patch)
tree6aa8dc840b085de50db46e2ad0725eae248fef02 /debian/tests/hostnamed
parentAdding upstream version 252.22. (diff)
downloadsystemd-b7e8d5af06ee840cc48217ca4629cf28aeeb3c50.tar.xz
systemd-b7e8d5af06ee840cc48217ca4629cf28aeeb3c50.zip
Adding debian version 252.22-1~deb12u1.debian/252.22-1_deb12u1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/hostnamed')
-rwxr-xr-xdebian/tests/hostnamed22
1 files changed, 22 insertions, 0 deletions
diff --git a/debian/tests/hostnamed b/debian/tests/hostnamed
new file mode 100755
index 0000000..1b22869
--- /dev/null
+++ b/debian/tests/hostnamed
@@ -0,0 +1,22 @@
+#!/bin/sh
+set -e
+
+. `dirname $0`/assert.sh
+
+ORIG_HOST=`cat /etc/hostname`
+echo "original hostname: $ORIG_HOST"
+
+# should activate daemon and work
+STATUS="`hostnamectl`"
+assert_in "Static hostname: $ORIG_HOST" "$STATUS"
+assert_in "Kernel:.* `uname -r`" "$STATUS"
+
+# change hostname
+assert_eq "`hostnamectl set-hostname testhost 2>&1`" ""
+assert_eq "`cat /etc/hostname`" "testhost"
+assert_in "Static hostname: testhost" "`hostnamectl`"
+
+# reset to original
+assert_eq "`hostnamectl set-hostname $ORIG_HOST 2>&1`" ""
+assert_eq "`cat /etc/hostname`" "$ORIG_HOST"
+assert_in "Static hostname: $ORIG_HOST" "`hostnamectl`"