summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-11-21 13:58:10 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2022-11-21 13:58:51 +0100
commit8bef48b670244def5f6df6934b5aae6889137ec7 (patch)
treeab9202010e05bb06c3844e1f395ad79941bc2ff6 /tests
parent325bd9868711cfe8ed30b7d2e522de762baa192f (diff)
downloadalpine-conf-8bef48b670244def5f6df6934b5aae6889137ec7.zip
setup-apkrepos: handle network errors
Diffstat (limited to 'tests')
-rwxr-xr-xtests/setup_alpine_test1
-rwxr-xr-xtests/setup_apkrepos_test20
2 files changed, 20 insertions, 1 deletions
diff --git a/tests/setup_alpine_test b/tests/setup_alpine_test
index 82e64b6..d7fbd87 100755
--- a/tests/setup_alpine_test
+++ b/tests/setup_alpine_test
@@ -8,6 +8,7 @@ init_tests \
setup_alpine_kvm_clock \
setup_alpine_restart_network
+export WGETCONTENT="https://mirror.example.com"
setup_alpine_usage_body() {
test_usage setup-alpine
}
diff --git a/tests/setup_apkrepos_test b/tests/setup_apkrepos_test
index f70b400..1998dbe 100755
--- a/tests/setup_apkrepos_test
+++ b/tests/setup_apkrepos_test
@@ -7,7 +7,8 @@ init_tests \
setup_apkrepos_https \
setup_apkrepos_random \
setup_apkrepos_first \
- setup_apkrepos_fastest
+ setup_apkrepos_fastest \
+ setup_apkrepos_network_failure
setup_apkrepos_usage_body() {
test_usage setup-apkrepos
@@ -55,3 +56,20 @@ setup_apkrepos_fastest_body() {
-o match:"Added mirror a[0-9].example.com" \
setup-apkrepos -f
}
+
+setup_apkrepos_network_failure_body() {
+ init_env
+ MIRRORS_URL=https://example.com/fail \
+ atf_check -s not-exit:0 \
+ -o match:"Finding" \
+ -e match:"Warning! No mirror found" \
+ setup-apkrepos -f
+ MIRRORS_URL=https://example.com/fail \
+ atf_check -s not-exit:0 \
+ -e match:"Warning" \
+ setup-apkrepos -r
+ MIRRORS_URL=https://example.com/fail \
+ atf_check -s not-exit:0 \
+ -e match:"Warning! No mirror found" \
+ setup-apkrepos -1
+}