summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/bin/apk17
-rwxr-xr-xtests/setup_alpine_test29
-rwxr-xr-xtests/setup_proxy_test2
-rwxr-xr-xtests/setup_sshd_test6
4 files changed, 44 insertions, 10 deletions
diff --git a/tests/bin/apk b/tests/bin/apk
index df1711c..ceff306 100755
--- a/tests/bin/apk
+++ b/tests/bin/apk
@@ -9,10 +9,9 @@ fi
rootfs=.
kver=5.15.78-0
-audit_prefix="U "
while [ $# -gt 0 ]; do
case "$1" in
- add|del)
+ add|del|cache|update)
echo "DEBUG: fake apk" "$@"
cmd="$1"
;;
@@ -24,7 +23,7 @@ while [ $# -gt 0 ]; do
rootfs="$1"
;;
--quiet)
- audit_prefix=""
+ quiet=1
shift ;;
--arch) shift ;;
--repositories-file) shift ;;
@@ -36,13 +35,21 @@ while [ $# -gt 0 ]; do
shift
done
-if [ "$cmd" = audit ]; then
+case "$cmd" in
+ audit)
mkdir -p etc
touch etc/hosts etc/localtime
+ if [ -z "$quiet" ]; then
+ audit_prefix="U "
+ fi
echo "${audit_prefix}etc/hosts"
echo "${audit_prefix}etc/localtime"
exit 0
-fi
+ ;;
+ cache|update|del)
+ exit 0
+ ;;
+esac
for pkg in $pkgs; do
case "$pkg" in
diff --git a/tests/setup_alpine_test b/tests/setup_alpine_test
index 11fce8e..dc84291 100755
--- a/tests/setup_alpine_test
+++ b/tests/setup_alpine_test
@@ -7,7 +7,8 @@ init_tests \
setup_alpine_create_answerfile \
setup_alpine_kvm_clock \
setup_alpine_restart_network \
- setup_alpine_answerfile_none
+ setup_alpine_answerfile_none \
+ setup_alpine_answerfile_apkcache
export WGETCONTENT="https://mirror.example.com"
setup_alpine_usage_body() {
@@ -139,3 +140,29 @@ setup_alpine_answerfile_none_body() {
done
}
+setup_alpine_answerfile_apkcache_body() {
+ init_env
+
+ cat >opts<<-EOF
+ KEYMAPOPTS=none
+ HOSTNAMEOPTS=alpine
+ INTERFACESOPTS=none
+ DNSOPTS=none
+ TIMEZONEOPTS=none
+ PROXYOPTS=none
+ NTPOPTS=none
+ APKREPOSOPTS=none
+ USEROPTS=none
+ SSHDOPTS=none
+ DISKOPTS=none
+ LBUOPTS=none
+ APKCACHEOPTS="media/LABEL=APKOVL/cache"
+ EOF
+ atf_check -s exit:0 \
+ -o match:"apk cache" \
+ setup-alpine -e -f opts
+ if ! [ -L etc/apk/cache ]; then
+ atf_fail "etc/apk/cache was not created"
+ fi
+}
+
diff --git a/tests/setup_proxy_test b/tests/setup_proxy_test
index 6fab883..5e0073c 100755
--- a/tests/setup_proxy_test
+++ b/tests/setup_proxy_test
@@ -14,7 +14,7 @@ setup_proxy_usage_body() {
setup_proxy_url_body() {
init_env
atf_check -s exit:0 \
- -o match:'^apk add.*wget' \
+ -o match:'apk add.*wget' \
-e empty \
setup-proxy https://example.com
grep http_proxy etc/profile.d/proxy.sh || atf_fail "http_proxy not set in etc/profile.d/proxy.sh"
diff --git a/tests/setup_sshd_test b/tests/setup_sshd_test
index 3d62f62..f44c4a4 100755
--- a/tests/setup_sshd_test
+++ b/tests/setup_sshd_test
@@ -29,7 +29,7 @@ setup_sshd_dropbear_body() {
init_env
atf_check -s exit:0 \
-e empty \
- -o match:"^apk add .* dropbear" \
+ -o match:"apk add .* dropbear" \
-o match:"service dropbear added" \
-o match:"Starting dropbear" \
setup-sshd dropbear
@@ -40,7 +40,7 @@ setup_sshd_openssh_body() {
export WGETCONTENT="ssh-id FOOBAR"
atf_check -s exit:0 \
-e empty \
- -o match:"^apk add .* openssh" \
+ -o match:"apk add .* openssh" \
-o match:"service sshd added" \
-o match:"Starting sshd" \
setup-sshd -k 'https://example.com/user.keys' openssh
@@ -58,7 +58,7 @@ setup_sshd_openssh_c_compat_body() {
init_env
atf_check -s exit:0 \
-e empty \
- -o match:"^apk add .* openssh" \
+ -o match:"apk add .* openssh" \
-o match:"service sshd added" \
-o match:"Starting sshd" \
-o not-match:"Allow root ssh" \