summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-05-11 23:20:54 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-05-11 23:20:54 +0200
commit88ad4d4a2f5fc17487b679ce23271508bca409a5 (patch)
tree8c33fdb2ea6b41288847a885635dfa82c81f3763
parentd6ef68b85ab1cc932b98a28b82c392a01d20765d (diff)
downloadalpine-conf-88ad4d4a2f5fc17487b679ce23271508bca409a5.zip
tests: add test for setup-sshd openssh
Also set timout to 1 second so we can catch unexpected interactive questions.
-rw-r--r--tests/Kyuafile2
-rwxr-xr-xtests/setup_sshd_test13
2 files changed, 14 insertions, 1 deletions
diff --git a/tests/Kyuafile b/tests/Kyuafile
index 77fd0bd..35ed6d6 100644
--- a/tests/Kyuafile
+++ b/tests/Kyuafile
@@ -2,4 +2,4 @@ syntax(2)
test_suite('alpine-conf')
-atf_test_program{name='setup_sshd_test'}
+atf_test_program{name='setup_sshd_test', timeout=1}
diff --git a/tests/setup_sshd_test b/tests/setup_sshd_test
index a373d8c..e813343 100755
--- a/tests/setup_sshd_test
+++ b/tests/setup_sshd_test
@@ -35,8 +35,21 @@ setup_sshd_dropbear_body() {
setup-sshd dropbear
}
+atf_test_case setup_sshd_openssh
+setup_sshd_openssh_body() {
+ init_env
+ atf_check -s exit:0 \
+ -e empty \
+ -o match:"^apk add .* openssh" \
+ -o match:"^rc-update add sshd" \
+ -o match:"^rc-service sshd start" \
+ setup-sshd -k 'https://example.com/user.keys' openssh
+ grep '^wget .*https://example.com/user.keys$' root/.ssh/authorized_keys || atf_fail "failed to wget ssh key"
+}
+
atf_init_test_cases() {
atf_add_test_case setup_sshd_help
atf_add_test_case setup_sshd_empty
atf_add_test_case setup_sshd_dropbear
+ atf_add_test_case setup_sshd_openssh
}