mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2025-01-12 01:39:45 +00:00
tests: abuild-fetch: test wget fallback
if curl is unavailable wget should be called
This commit is contained in:
parent
d708a813a3
commit
cb9ac5be89
@ -15,6 +15,18 @@ setup() {
|
||||
exit \${CURL_EXITCODE:-0}
|
||||
EOF
|
||||
chmod +x "$bindir"/curl
|
||||
|
||||
# fake wget
|
||||
cat >> "$bindir"/wget <<-EOF
|
||||
#!/bin/sh
|
||||
|
||||
PATH=/usr/local/bin:/usr/bin:/bin
|
||||
touch "$tmpdir"/wget-invoked
|
||||
echo "Fake wget invoked with: \$@"
|
||||
exit \${WGET_EXITCODE:-0}
|
||||
EOF
|
||||
chmod +x "$bindir"/wget
|
||||
|
||||
}
|
||||
|
||||
teardown() {
|
||||
@ -34,3 +46,15 @@ teardown() {
|
||||
run CURL_EXITCODE=1 $ABUILD_FETCH -d "$tmpdir" https://example.com/non-existing
|
||||
[ $status -ne 0 ]
|
||||
}
|
||||
|
||||
@test "abuild-fetch: test wget fallback" {
|
||||
rm "$bindir"/curl
|
||||
PATH="$bindir" $ABUILD_FETCH -d "$tmpdir" https://example.com/non-existing
|
||||
[ -f "$tmpdir"/wget-invoked ]
|
||||
}
|
||||
|
||||
@test "abuild-fetch: test wget fallback failure" {
|
||||
rm "$bindir"/curl
|
||||
run PATH="$bindir" WGET_EXITCODE=1 $ABUILD_FETCH -d "$tmpdir" https://example.com/non-existing
|
||||
[ $status -ne 0 ]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user