summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-05-11 23:49:42 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-05-11 23:49:42 +0200
commitd7911c4d043721995907a8f8a6570c4a42416ef9 (patch)
treeb5685e6bf26c927651e8599424d0c91f0b7db1e2 /tests
parent8646bb465582652dfe0f84f7dbec93979fa83170 (diff)
downloadalpine-conf-d7911c4d043721995907a8f8a6570c4a42416ef9.zip
tests: add tst for setup-hostname
only test the -h help text for now
Diffstat (limited to 'tests')
-rw-r--r--tests/Kyuafile1
-rwxr-xr-xtests/setup_hostname_test23
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/Kyuafile b/tests/Kyuafile
index 35ed6d6..784f1ab 100644
--- a/tests/Kyuafile
+++ b/tests/Kyuafile
@@ -3,3 +3,4 @@ syntax(2)
test_suite('alpine-conf')
atf_test_program{name='setup_sshd_test', timeout=1}
+atf_test_program{name='setup_hostname_test', timeout=1}
diff --git a/tests/setup_hostname_test b/tests/setup_hostname_test
new file mode 100755
index 0000000..5b801cf
--- /dev/null
+++ b/tests/setup_hostname_test
@@ -0,0 +1,23 @@
+#!/usr/bin/env atf-sh
+
+init_env() {
+ PATH=$(atf_get_srcdir)/..:$PATH
+ export ROOT=$PWD LIBDIR=$(atf_get_srcdir)/.. MOCK=echo
+}
+
+# docs:
+# - https://github.com/jmmv/kyua/wiki/Quickstart-atf-sh-test
+# - https://manned.org/atf-sh-api
+
+atf_test_case setup_hostname_help
+setup_hostname_help_body() {
+ init_env
+ atf_check -s exit:0 \
+ -o match:'^usage: setup-hostname' \
+ -e empty \
+ setup-hostname -h
+}
+
+atf_init_test_cases() {
+ atf_add_test_case setup_hostname_help
+}