Skip to content

Commit 7b5bc97

Browse files
committed
Enable Mysql tests
1 parent b308f91 commit 7b5bc97

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

.github/workflows/unit-tests.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,20 @@ jobs:
1717
env:
1818
POSTGRES_USER: postgres
1919
POSTGRES_PASSWORD: postgres
20-
POSTGRES_DB: a2a_test
2120
ports:
2221
- 5432:5432
22+
volumes:
23+
- ${{ github.workspace }}/tests/docker/postgres:/docker-entrypoint-initdb.d
24+
mysql:
25+
image: mysql:8.0
26+
env:
27+
MYSQL_ROOT_PASSWORD: root
28+
ports:
29+
- 3306:3306
30+
volumes:
31+
- ${{ github.workspace }}/tests/docker/mysql:/docker-entrypoint-initdb.d
32+
options: >-
33+
--health-cmd="mysqladmin ping -h localhost -u root -proot" --health-interval=10s --health-timeout=5s --health-retries=5
2334
2435
strategy:
2536
matrix:
@@ -31,11 +42,10 @@ jobs:
3142
uses: actions/setup-python@v5
3243
with:
3344
python-version: ${{ matrix.python-version }}
34-
- name: Set postgres for tests
35-
run: |
36-
sudo apt-get update && sudo apt-get install -y postgresql-client
37-
PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d a2a_test -f ${{ github.workspace }}/tests/docker/postgres/init.sql
38-
echo "POSTGRES_TEST_DSN=postgresql+asyncpg://postgres:postgres@localhost:5432/a2a_test" >> $GITHUB_ENV
45+
- name: Set up databases for tests
46+
run: |
47+
echo "POSTGRES_TEST_DSN=postgresql+asyncpg://a2a:a2a_password@localhost:5432/a2a_test" >> $GITHUB_ENV
48+
echo "MYSQL_TEST_DSN=mysql+aiomysql://a2a:a2a_password@localhost:3306/a2a_test" >> $GITHUB_ENV
3949
4050
- name: Install uv
4151
uses: astral-sh/setup-uv@v6

tests/docker/mysql/init.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- Create a dedicated user for the application
2+
CREATE USER a2a WITH PASSWORD 'a2a_password';
3+
4+
-- Create the tasks database
5+
CREATE DATABASE a2a_test;
6+
7+
GRANT ALL PRIVILEGES ON DATABASE a2a_test TO a2a;
8+

tests/docker/postgres/init.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
CREATE USER a2a WITH PASSWORD 'a2a_password';
33

44
-- Create the tasks database
5-
CREATE DATABASE a2a_tasks;
5+
CREATE DATABASE a2a_test;
66

77
GRANT ALL PRIVILEGES ON DATABASE a2a_test TO a2a;
88

0 commit comments

Comments
 (0)