Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up and improve structure of integration tests #256

Merged
merged 3 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
php-version: ${{ matrix.php }}
- run: composer install -d tests/integration/
- run: php tests/integration/public/index.php &
- run: bash tests/await.sh
- run: bash tests/await.bash
- run: bash tests/integration.bash

Docker:
Expand All @@ -104,7 +104,7 @@ jobs:
- run: composer install -d tests/integration/
- run: docker build -f tests/integration/${{ matrix.dockerfile }} tests/integration/
- run: docker run -d -p 8080:8080 -v "$PWD/composer.json":/app/composer.json $(docker images -q | head -n1)
- run: bash tests/await.sh
- run: bash tests/await.bash
- run: bash tests/integration.bash
- run: docker stop $(docker ps -qn1)
- run: docker logs $(docker ps -qn1)
Expand All @@ -129,8 +129,8 @@ jobs:
- run: docker build -f tests/integration/Dockerfile-basics tests/integration/
- run: docker run -d -p 8080:8080 -v "$PWD/composer.json":/app/composer.json $(docker images -q | head -n1)
- run: docker run -d --net=host -v "$PWD/tests/integration/":/home/framework-x/ -v "$PWD"/tests/integration/${{ matrix.config.path }}:/etc/nginx/conf.d/default.conf nginx:stable-alpine
- run: bash tests/await.sh http://localhost
- run: bash tests/integration.bash http://localhost
- run: bash tests/await.bash http://localhost/
- run: bash tests/integration.bash http://localhost/
- run: docker stop $(docker ps -qn2)
- run: docker logs $(docker ps -qn1)
if: ${{ always() }}
Expand Down Expand Up @@ -159,8 +159,8 @@ jobs:
- run: composer install -d tests/integration/
- run: docker run -d -v "$PWD/tests/integration/":/home/framework-x/ php:${{ matrix.php }}-fpm
- run: docker run -d -p 80:80 --link $(docker ps -qn1):php -v "$PWD/tests/integration/":/home/framework-x/ -v "$PWD"/tests/integration/nginx-fpm.conf:/etc/nginx/conf.d/default.conf nginx:stable-alpine
- run: bash tests/await.sh http://localhost
- run: bash tests/integration.bash http://localhost
- run: bash tests/await.bash http://localhost/
- run: bash tests/integration.bash http://localhost/
- run: docker logs $(docker ps -qn1)
if: ${{ always() }}

Expand All @@ -185,8 +185,8 @@ jobs:
php-version: ${{ matrix.php }}
- run: composer install -d tests/integration/
- run: docker run -d -p 80:80 -v "$PWD/tests/integration/":/home/framework-x/ php:${{ matrix.php }}-apache sh -c "rmdir /var/www/html;ln -s /home/framework-x/public /var/www/html;ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled; apache2-foreground"
- run: bash tests/await.sh http://localhost
- run: bash tests/integration.bash http://localhost
- run: bash tests/await.bash http://localhost/
- run: bash tests/integration.bash http://localhost/
- run: docker logs $(docker ps -qn1)
if: ${{ always() }}

Expand All @@ -211,5 +211,5 @@ jobs:
php-version: ${{ matrix.php }}
- run: composer install -d tests/integration/
- run: php -S localhost:8080 tests/integration/public/index.php &
- run: bash tests/await.sh
- run: bash tests/await.bash
- run: bash tests/integration.bash
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ your installation like this:

```bash
$ php tests/integration/public/index.php
$ tests/integration.bash http://localhost:8080
$ tests/integration.bash http://localhost:8080/
```

## License
Expand Down
5 changes: 3 additions & 2 deletions tests/await.sh → tests/await.bash
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash

base=${1:-http://localhost:8080}
base=${1:-http://localhost:8080/}
base=${base%/}

for i in {1..20}
for i in {1..600}
do
out=$(curl -v -X PROBE $base/ 2>&1) && exit 0 || echo -n .
sleep 0.1
Expand Down
Loading