Skip to content

Commit 0605e24

Browse files
committed
Add comprehensive AsyncPostgreSQLPool integration tests and CI database support
- Add AsyncPostgreSQLPool test suite with 397 lines covering initialization, configuration validation, connection management, and real database operations - Implement PostgreSQL availability detection and environment-based configuration for integration tests - Add connection pooling tests for reuse, concurrent operations, and failure handling scenarios - Update GitHub Actions workflow to support both MySQL and PostgreSQL test matrices with proper service containers and health checks - Add database-specific environment variables and wait conditions for reliable CI testing
1 parent 35dabda commit 0605e24

File tree

2 files changed

+463
-9
lines changed

2 files changed

+463
-9
lines changed

.github/workflows/test.yml

Lines changed: 66 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,81 @@
11
name: Tests
2-
3-
on: ['push', 'pull_request']
4-
2+
3+
on: [push, pull_request]
4+
55
jobs:
66
ci:
77
runs-on: ubuntu-latest
8-
8+
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
db: [mysql, pgsql]
13+
14+
services:
15+
mysql:
16+
image: mysql:8.0
17+
ports:
18+
- 3306:3306
19+
env:
20+
MYSQL_ROOT_PASSWORD: root
21+
MYSQL_DATABASE: testdb
22+
MYSQL_USER: testuser
23+
MYSQL_PASSWORD: testpass
24+
options: >-
25+
--health-cmd="mysqladmin ping -h localhost -u root --password=root"
26+
--health-interval=10s
27+
--health-timeout=5s
28+
--health-retries=5
29+
30+
postgres:
31+
image: postgres:15
32+
ports:
33+
- 5432:5432
34+
env:
35+
POSTGRES_DB: testdb
36+
POSTGRES_USER: testuser
37+
POSTGRES_PASSWORD: testpass
38+
options: >-
39+
--health-cmd="pg_isready -U testuser -d testdb"
40+
--health-interval=10s
41+
--health-timeout=5s
42+
--health-retries=5
43+
944
steps:
1045
- name: Checkout
1146
uses: actions/checkout@v3
12-
47+
1348
- name: Setup PHP
1449
uses: shivammathur/setup-php@v2
1550
with:
1651
php-version: 8.2
1752
tools: composer:v2
1853
coverage: xdebug
19-
54+
extensions: pdo_mysql, pdo_pgsql
55+
2056
- name: Install Dependencies
2157
run: composer install --no-interaction --prefer-dist --optimize-autoloader
22-
23-
- name: Tests
24-
run: ./vendor/bin/pest --ci
58+
59+
- name: Wait for DB
60+
run: |
61+
if [ "${{ matrix.db }}" = "mysql" ]; then
62+
echo "Waiting for MySQL..."
63+
until mysqladmin ping -h 127.0.0.1 -u root --password=root --silent; do
64+
sleep 2
65+
done
66+
else
67+
echo "Waiting for PostgreSQL..."
68+
until pg_isready -h 127.0.0.1 -U testuser -d testdb; do
69+
sleep 2
70+
done
71+
fi
72+
73+
- name: Run Pest Tests
74+
env:
75+
DB_CONNECTION: ${{ matrix.db }}
76+
DB_HOST: 127.0.0.1
77+
DB_PORT: ${{ matrix.db == 'mysql' && '3306' || '5432' }}
78+
DB_DATABASE: testdb
79+
DB_USERNAME: testuser
80+
DB_PASSWORD: testpass
81+
run: ./vendor/bin/pest --ci

0 commit comments

Comments
 (0)