Fix test runner
This commit is contained in:
parent
21feb31ee6
commit
db4ee8e0f2
5 changed files with 28 additions and 16 deletions
12
.github/workflows/tests.yml
vendored
12
.github/workflows/tests.yml
vendored
|
@ -14,11 +14,11 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Start Bouncer
|
||||
run: docker compose up --build -d bouncer test-box
|
||||
|
||||
run: |
|
||||
rm -f docker-compose.override.yml
|
||||
docker compose up --build -d bouncer test-box
|
||||
- name: Give it a moment...
|
||||
run: sleep 5
|
||||
|
||||
- name: No-SSL Connect to Web A
|
||||
run: |
|
||||
docker compose exec test-box curl -s -D - http://a.example.org > a.nossl.http
|
||||
|
@ -29,7 +29,6 @@ jobs:
|
|||
docker compose exec test-box curl -s -k -D - https://a.example.org 2>&1 > a.ssl.http;
|
||||
grep "HTTP/1.1 200 OK" a.ssl.http;
|
||||
grep "<h1>Website A</h1>" a.ssl.http;
|
||||
|
||||
- name: No-SSL Connect to Web B
|
||||
run: |
|
||||
docker compose exec test-box curl -s -D - http://b.example.org 2>&1 > b.nossl.http
|
||||
|
@ -40,7 +39,6 @@ jobs:
|
|||
docker compose exec test-box curl -s -k -D - https://b.example.org 2>&1 > b.ssl.http
|
||||
grep "HTTP/1.1 200 OK" b.ssl.http
|
||||
grep "<h1>Website B</h1>" b.ssl.http
|
||||
|
||||
- name: No-SSL Connect to SSL-redirect
|
||||
run: |
|
||||
docker compose exec test-box curl -s -D - http://redirect-to-ssl.example.org 2>&1 > redirect.nossl.http
|
||||
|
@ -53,20 +51,16 @@ jobs:
|
|||
docker compose exec test-box curl -s -k -D - https://redirect-to-ssl.example.org 2>&1 > redirect.ssl.http
|
||||
grep "HTTP/1.1 200 OK" redirect.ssl.http
|
||||
grep "<h1>Website redirect-to-ssl</h1>" redirect.ssl.http
|
||||
|
||||
- name: Connect to Plural multiple times and verify it loadbalances
|
||||
run: |
|
||||
rm -f plural_requests
|
||||
for i in {1..20}; do
|
||||
docker compose exec test-box curl -s -k https://plural.example.org 2>&1 >> plural_requests
|
||||
done
|
||||
|
||||
requests=$(cat plural_requests | grep "Running on" | sort | uniq | wc -l)
|
||||
echo "Unique Servers: $requests"
|
||||
|
||||
# We should have exactly 3
|
||||
test $requests -eq 3
|
||||
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
run: docker compose down -v --remove-orphans
|
||||
|
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,5 +1,4 @@
|
|||
.idea
|
||||
/docker-compose.override.yml
|
||||
/.php-cs-fixer.cache
|
||||
/.github/cache
|
||||
/.secrets
|
||||
/.secrets
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
|
||||
use Bouncer\Bouncer;
|
||||
define("APP_ROOT", realpath(__DIR__ . "/../"));
|
||||
# If vendor/autoload.php does not exist, we should bomb out and scream
|
||||
if (!file_exists(APP_ROOT . '/vendor/autoload.php')) {
|
||||
echo "You must run composer install before running this script\n";
|
||||
exit(1);
|
||||
}
|
||||
require_once APP_ROOT . '/vendor/autoload.php';
|
||||
|
||||
(new Bouncer())->run();
|
||||
|
|
19
docker-compose.override.yml
Normal file
19
docker-compose.override.yml
Normal file
|
@ -0,0 +1,19 @@
|
|||
services:
|
||||
bouncer:
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ./src:/app/src
|
||||
- ./templates:/app/templates
|
||||
- ./vendor:/app/vendor
|
||||
web-a:
|
||||
volumes:
|
||||
- ./tests/testsites:/app/public
|
||||
web-b:
|
||||
volumes:
|
||||
- ./tests/testsites:/app/public
|
||||
web-plural:
|
||||
volumes:
|
||||
- ./tests/testsites:/app/public
|
||||
web-redirect-ssl:
|
||||
volumes:
|
||||
- ./tests/testsites:/app/public
|
|
@ -10,9 +10,6 @@ services:
|
|||
- php:cli=docker-image://ghcr.io/benzine-framework/php:cli-8.2
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ./src:/app/src
|
||||
- ./templates:/app/templates
|
||||
- ./vendor:/app/vendor
|
||||
networks:
|
||||
default:
|
||||
aliases:
|
||||
|
@ -36,8 +33,6 @@ services:
|
|||
target: test-app
|
||||
additional_contexts:
|
||||
- php:nginx=docker-image://ghcr.io/benzine-framework/php:nginx-8.2
|
||||
volumes:
|
||||
- ./tests/testsites:/app/public
|
||||
environment:
|
||||
- BOUNCER_DOMAIN=a.example.org
|
||||
- BOUNCER_TARGET_PORT=80
|
||||
|
|
Loading…
Reference in a new issue