Skip to content
Snippets Groups Projects
Commit 81ef4ce0 authored by Maxb's avatar Maxb
Browse files

Add reconnect integration test

We can easily check that the obfsvpn client will reconnect to our
obfsvpn host servers by restarting the server docker containers in our
integration test after the initial successful connection and then
assuring that they are able to connect again after a reasonable time :)
parent 4ab3ef9e
Branches
Tags
1 merge request!62Add reconnect integration test
......@@ -46,18 +46,38 @@ docker compose -p "$mode" build --parallel --no-cache
docker compose -p "$mode" --env-file $env_file up -d --build
# need to wait for openvpn to generate configs
max_retry=40
max_initial_retry=40
counter=0
# Testing bridged tunnel
until docker compose -p "$mode" --env-file $env_file exec client ping -c 3 -I tun0 8.8.8.8
do
((counter++))
[[ counter -eq $max_retry ]] && echo "Failed!" | tee -a $logfile && exit 1
[[ counter -eq $max_initial_retry ]] && echo "Failed!" | tee -a $logfile && exit 1
echo "Pinging in client container with config $(cat ${env_file} | grep KCP) and $(cat ${env_file} | grep HOP_PT) failed. Trying again. Try #$counter" | tee -a $logfile
sleep 30
done
counter=0
max_reconnect_retry=10
if [[ "$LIVE_TEST" == "0" ]]; then
echo "Testing reconnect"
# We can't just restart the obfsvpn servers because of some very odd way that key material is being generated so we go down and up instead 🤷
docker compose -p "$mode" --env-file $env_file down obfsvpn-1 obfsvpn-2
docker compose -p "$mode" --env-file $env_file up -d obfsvpn-1 obfsvpn-2
until docker compose -p "$mode" --env-file $env_file exec client ping -c 3 -I tun0 8.8.8.8
do
((counter++))
[[ counter -eq $max_reconnect_retry ]] && echo "Failed!" | tee -a $logfile && exit 1
echo "Pinging in client container with config $(cat ${env_file} | grep KCP) and $(cat ${env_file} | grep HOP_PT) after reconnect failed. Trying again. Try #$counter" | tee -a $logfile
sleep 10
done
fi
docker compose -p "$mode" --env-file $env_file exec client ndt7-client -quiet | tee -a $logfile
# Testing bridge control panel
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment