-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_infrastructure.sh
executable file
·34 lines (23 loc) · 1.01 KB
/
test_infrastructure.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
set -eux
source example.env
TIMEOUT=3
export DOMAIN=
dc="docker compose --env-file example.env"
dct="$dc --file docker-compose.yml --file docker-compose.test.yml"
vpn="$dct run test-vpn"
ext="$dct run test-external"
$dct up --build --force-recreate --no-start
echo start regular containers
$dc up --detach
echo wait for ingress to boot
timeout ${TIMEOUT}s bash -c "while ! docker inspect $INGRESS_NAME | grep '\"Status\": \"running\"' > /dev/null; do true; done"
echo ingress works across vpn
$vpn bash -c "sleep ${TIMEOUT}; curl -m ${TIMEOUT} -H 'Host: whoami.$DOMAIN' ${INGRESS_ADDRESS}"
echo ingress not accessible outside vpn
$ext sh -c "sleep ${TIMEOUT}; ! curl -m ${TIMEOUT} -H 'Host: whoami.$DOMAIN' ${INGRESS_ADDRESS}"
## TODO
#echo vpn allows access between clients
#$dct up --detach test-vpn2
#timeout ${TIMEOUT}s bash -c "while ! docker inspect homy_test-vpn2_1 | grep '\"Status\": \"running\"' > /dev/null; do true; done"
#$vpn bash -c "sleep ${TIMEOUT}; ping -c 1 -W ${TIMEOUT} ${VPN_SUBNET/%.0/.3}"