mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2025-01-12 10:00:53 +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}
|
exit \${CURL_EXITCODE:-0}
|
||||||
EOF
|
EOF
|
||||||
chmod +x "$bindir"/curl
|
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() {
|
teardown() {
|
||||||
@ -34,3 +46,15 @@ teardown() {
|
|||||||
run CURL_EXITCODE=1 $ABUILD_FETCH -d "$tmpdir" https://example.com/non-existing
|
run CURL_EXITCODE=1 $ABUILD_FETCH -d "$tmpdir" https://example.com/non-existing
|
||||||
[ $status -ne 0 ]
|
[ $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