summaryrefslogtreecommitdiff
path: root/tests/setup_apkrepos_test
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-11-21 12:19:17 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2022-11-21 12:31:15 +0100
commit6a6db15345350a526c06d3bdb31e395a87755a07 (patch)
tree8d3ea0d2115afddc6beb1bb3d8be2dbed6b41235 /tests/setup_apkrepos_test
parent9dac5805908aa828d949fc0ffca03bb0cb7e9afb (diff)
downloadalpine-conf-6a6db15345350a526c06d3bdb31e395a87755a07.zip
setup-apkrepos: fix mirror counting
when piping the mirror list to `more` the mirror_count is set in a subshell and will end up unset. fixes error when selecting random mirror: /sbin/setup-apkrepos: line 31: arithmetic syntax error fixes commit 860b7271232a (APK Repo Setup)
Diffstat (limited to 'tests/setup_apkrepos_test')
-rwxr-xr-xtests/setup_apkrepos_test10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/setup_apkrepos_test b/tests/setup_apkrepos_test
index bf57b4f..bb152c0 100755
--- a/tests/setup_apkrepos_test
+++ b/tests/setup_apkrepos_test
@@ -3,7 +3,8 @@
. $(atf_get_srcdir)/test_env.sh
init_tests \
setup_apkrepos_usage \
- setup_apkrepos_https
+ setup_apkrepos_https \
+ setup_apkrepos_random
setup_apkrepos_usage_body() {
test_usage setup-apkrepos
@@ -20,3 +21,10 @@ setup_apkrepos_https_body() {
grep -q 'https://example.com' etc/apk/repositories || atf_fail "example.com was not added to /etc/apk/repositories"
}
+setup_apkrepos_random_body() {
+ init_env
+ export WGETCONTENT="$(seq 0 9 | awk '{print "https://a" $0 ".example.com"}')"
+ atf_check -s exit:0 \
+ -o match:"Added mirror a[0-9].example.com" \
+ setup-apkrepos -r
+}