Skip to content

Commit

Permalink
Migrate docker-compose to new format
Browse files Browse the repository at this point in the history
  • Loading branch information
csandanov committed Sep 9, 2024
1 parent 2e33ba2 commit b04ffe4
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 23 deletions.
2 changes: 0 additions & 2 deletions tests/basic/docker-compose.yml → tests/basic/compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "2"

services:
nginx:
image: wodby/nginx
Expand Down
14 changes: 7 additions & 7 deletions tests/basic/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ if [[ -n "${DEBUG}" ]]; then
fi

varnish() {
docker-compose exec -T varnish "${@}"
docker compose exec -T varnish "${@}"
}

docker-compose up -d
docker compose up -d

echo -n "Running check-ready action... "
varnish make check-ready max_try=10 -f /usr/local/bin/actions.mk
Expand All @@ -27,25 +27,25 @@ varnish curl -s -o /dev/null -w '%{http_code}' "localhost:6081/.vchealthz" | gre
echo "OK"

echo -n "Checking varnish backend response containing a country code header detected via geoip module... "
docker-compose exec -T php sh -c 'echo "<?php var_dump(\$_SERVER[\"HTTP_X_COUNTRY_CODE\"]);" > /var/www/html/index.php'
docker compose exec -T php sh -c 'echo "<?php var_dump(\$_SERVER[\"HTTP_X_COUNTRY_CODE\"]);" > /var/www/html/index.php'
varnish curl --header "X-Real-IP: ${us_ip}" -s "localhost:6081" | grep -q "US"
varnish make flush -f /usr/local/bin/actions.mk
echo "OK"

echo -n "Checking varnish backend response containing the currency... "
docker-compose exec -T php sh -c 'echo "<?php var_dump(\$_SERVER[\"HTTP_X_CURRENCY\"]);" > /var/www/html/index.php'
docker compose exec -T php sh -c 'echo "<?php var_dump(\$_SERVER[\"HTTP_X_CURRENCY\"]);" > /var/www/html/index.php'
varnish curl --header "X-Real-IP: ${us_ip}" -s "localhost:6081" | grep -q "USD"
varnish make flush -f /usr/local/bin/actions.mk
echo "OK"

echo -n "Checking varnish backend response containing the currency (from Cloudflare \"CF-IPCountry\" header)... "
docker-compose exec -T php sh -c 'echo "<?php var_dump(\$_SERVER[\"HTTP_X_CURRENCY\"]);" > /var/www/html/index.php'
docker compose exec -T php sh -c 'echo "<?php var_dump(\$_SERVER[\"HTTP_X_CURRENCY\"]);" > /var/www/html/index.php'
varnish curl --header "CF-IPCountry: US" -s "localhost:6081" | grep -q "USD"
varnish make flush -f /usr/local/bin/actions.mk
echo "OK"

echo -n "Checking varnish VCKEY cookies... "
docker-compose exec -T php sh -c 'echo "<?php echo(\"Hello World\");" > /var/www/html/index.php'
docker compose exec -T php sh -c 'echo "<?php echo(\"Hello World\");" > /var/www/html/index.php'
varnish sh -c 'curl -sI -b "VCKEYinvalid=123" localhost:6081 | grep -q "X-VC-Cache: MISS"'
varnish sh -c 'curl -sI -b "VCKEYinvalid=123" localhost:6081 | grep -q "X-VC-Cache: MISS"'
varnish sh -c 'curl -sI -b "VCKEY-.invalid=123" localhost:6081 | grep -q "X-VC-Cache: MISS"'
Expand All @@ -59,4 +59,4 @@ varnish sh -c 'curl -sI -b "VCKEY-valid=123; VCKEY-multiple-cookies_1=123;" loca
varnish sh -c 'curl -sI -b "VCKEY-valid=123; VCKEY-multiple-cookies_1=321;" localhost:6081 | grep -q "X-VC-Cache: MISS"'
echo "OK"

docker-compose down
docker compose down
2 changes: 0 additions & 2 deletions tests/drupal/docker-compose.yml → tests/drupal/compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "2"

services:
nginx:
image: nginx:stable-alpine
Expand Down
10 changes: 5 additions & 5 deletions tests/drupal/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ if [[ -n "${DEBUG}" ]]; then
set -x
fi

docker-compose up -d
docker compose up -d

echo "Running check-ready action... "
docker-compose exec -T varnish make check-ready max_try=10 wait_seconds=1 delay_seconds=1 -f /usr/local/bin/actions.mk
docker compose exec -T varnish make check-ready max_try=10 wait_seconds=1 delay_seconds=1 -f /usr/local/bin/actions.mk

echo "Running flush action... "
docker-compose exec -T varnish make flush -f /usr/local/bin/actions.mk
docker compose exec -T varnish make flush -f /usr/local/bin/actions.mk

echo -n "Checking varnish backend response... "
docker-compose exec -T varnish curl -s "localhost:6081" | grep -q 'Welcome to nginx!'
docker compose exec -T varnish curl -s "localhost:6081" | grep -q 'Welcome to nginx!'
echo "OK"

docker-compose down
docker compose down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "2"

services:
nginx:
image: nginx:stable-alpine
Expand Down
10 changes: 5 additions & 5 deletions tests/wordpress/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ if [[ -n "${DEBUG}" ]]; then
set -x
fi

docker-compose up -d
docker compose up -d

echo "Running check-ready action... "
docker-compose exec -T varnish make check-ready max_try=10 -f /usr/local/bin/actions.mk
docker compose exec -T varnish make check-ready max_try=10 -f /usr/local/bin/actions.mk

echo "Running flush action... "
docker-compose exec -T varnish make flush -f /usr/local/bin/actions.mk
docker compose exec -T varnish make flush -f /usr/local/bin/actions.mk

echo -n "Checking varnish backend response... "
docker-compose exec -T varnish curl -s "localhost:6081" | grep -q 'Welcome to nginx!'
docker compose exec -T varnish curl -s "localhost:6081" | grep -q 'Welcome to nginx!'
echo "OK"

docker-compose down
docker compose down

0 comments on commit b04ffe4

Please sign in to comment.