summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-05-13 13:08:35 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-05-13 15:52:55 +0200
commit43c48a8cba324b1c960094487c094a09711a2b4e (patch)
treecf95573637035bbf8cb43838cf13b306fba13500
parentf14d70b6b88801ccc15dd79172f16abc21fd1856 (diff)
downloadalpine-conf-43c48a8cba324b1c960094487c094a09711a2b4e.zip
tests: add test for setup-apkcache
-rwxr-xr-xtests/setup_apkcache_test31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/setup_apkcache_test b/tests/setup_apkcache_test
new file mode 100755
index 0000000..f0af6d3
--- /dev/null
+++ b/tests/setup_apkcache_test
@@ -0,0 +1,31 @@
+#!/usr/bin/env atf-sh
+
+. $(atf_get_srcdir)/test_env.sh
+init_tests \
+ setup_apkcache_usage \
+ setup_apkcache_abspath \
+ setup_apkcache_relpath_with_slash
+
+setup_apkcache_usage_body() {
+ test_usage setup-apkcache
+}
+
+setup_apkcache_abspath_body() {
+ init_env
+ atf_check -s exit:0 \
+ -o empty \
+ -e empty \
+ setup-apkcache /media/LABEL=APKOVL/cache
+ [ "$(readlink etc/apk/cache)" = "/media/LABEL=APKOVL/cache" ] \
+ || atf_fail "etc/apk/cache is not a symlink to /media/LABEL=APKOVL/cache"
+}
+
+setup_apkcache_relpath_with_slash_body() {
+ init_env
+ atf_check -s exit:0 \
+ -o empty \
+ -e empty \
+ setup-apkcache media/LABEL=APKOVL/cache
+ [ "$(readlink etc/apk/cache)" = "/media/LABEL=APKOVL/cache" ] \
+ || atf_fail "etc/apk/cache is symlink to $(readlink /etc/apk/cache) instead of /media/LABEL=APKOVL/cache"
+}