Set curl timeout in CI (#38)

Co-authored-by: Jordan Potter <me@jordanpotter.com>
This commit is contained in:
Jordan Potter 2023-10-11 09:13:38 -07:00 committed by GitHub
parent b3044bdd6e
commit 5c07117e1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,8 +54,8 @@ jobs:
run: |
for cmd in "docker" "podman" "sudo podman"; do
$cmd run --rm -d --name wireguard --cap-add NET_ADMIN --cap-add NET_RAW --cap-add SYS_MODULE --sysctl net.ipv4.conf.all.src_valid_mark=1 -v ${{ github.workspace }}/wireguard.conf:/etc/wireguard/wg0.conf wireguard
normal_ip=$($cmd run --rm curlimages/curl --retry 3 --retry-delay 1 --retry-all-errors ifconfig.io)
wireguard_ip=$($cmd run --rm --net=container:wireguard curlimages/curl --retry 3 --retry-delay 1 --retry-all-errors ifconfig.io)
normal_ip=$($cmd run --rm curlimages/curl --max-time 3 --retry 3 --retry-delay 1 --retry-all-errors ifconfig.io)
wireguard_ip=$($cmd run --rm --net=container:wireguard curlimages/curl --max-time 3 --retry 3 --retry-delay 1 --retry-all-errors ifconfig.io)
if [ "$normal_ip" = "$wireguard_ip" ]; then echo "normal ip and wireguard ip are the same" && exit 1; fi
$cmd stop wireguard
done
@ -64,9 +64,9 @@ jobs:
run: |
for cmd in "docker" "podman" "sudo podman"; do
$cmd run --rm -d --name wireguard --cap-add NET_ADMIN --cap-add NET_RAW --cap-add SYS_MODULE --sysctl net.ipv4.conf.all.src_valid_mark=1 -v ${{ github.workspace }}/wireguard.conf:/etc/wireguard/wg0.conf wireguard
$cmd run --rm --net=container:wireguard curlimages/curl --retry 3 --retry-delay 1 --retry-all-errors ifconfig.io
$cmd run --rm --net=container:wireguard curlimages/curl --max-time 3 --retry 3 --retry-delay 1 --retry-all-errors ifconfig.io
$cmd exec wireguard wg-quick down wg0
! $cmd run --rm --net=container:wireguard curlimages/curl --retry 3 --retry-delay 1 --retry-all-errors ifconfig.io
! $cmd run --rm --net=container:wireguard curlimages/curl --max-time 3 --retry 3 --retry-delay 1 --retry-all-errors ifconfig.io
$cmd stop wireguard
done
@ -76,7 +76,7 @@ jobs:
ip_address=$(ip route get 1.2.3.4 | awk '{print $7}')
$cmd run --rm -d --name nginx -p 8080:80 nginx
$cmd run --rm -d --name wireguard --cap-add NET_ADMIN --cap-add NET_RAW --cap-add SYS_MODULE --sysctl net.ipv4.conf.all.src_valid_mark=1 -v ${{ github.workspace }}/wireguard.conf:/etc/wireguard/wg0.conf -e LOCAL_SUBNETS=$ip_address/32 wireguard
$cmd run --rm --net=container:wireguard curlimages/curl --retry 3 --retry-delay 1 --retry-all-errors $ip_address:8080
$cmd run --rm --net=container:wireguard curlimages/curl --max-time 3 --retry 3 --retry-delay 1 --retry-all-errors $ip_address:8080
$cmd stop wireguard nginx
done
@ -85,7 +85,7 @@ jobs:
for cmd in "docker" "podman" "sudo podman"; do
$cmd run --rm -d --name wireguard --cap-add NET_ADMIN --cap-add NET_RAW --cap-add SYS_MODULE --sysctl net.ipv4.conf.all.src_valid_mark=1 -v ${{ github.workspace }}/wireguard.conf:/etc/wireguard/wg0.conf -p 8080:80 wireguard
$cmd run --rm -d --name nginx --net=container:wireguard nginx
curl --retry 3 --retry-delay 1 --retry-all-errors localhost:8080
curl --max-time 3 --retry 3 --retry-delay 1 --retry-all-errors localhost:8080
$cmd stop wireguard nginx
done