Skip to content

Commit 1376c6b

Browse files
authored
Run tests as GitHub Actions (#376)
To easier find out when changes break the tests. - Use Python 3.7 for starters, because it's the oldest still-supported CPython interpreter version. More can be added in a subsequent step. - Use "docker compose" to run the Percona versions from the dev readme. Different MySQL implementations (e.g. MariaDB, Oracle, etc.) could be added on top. - The test suite is skipping `test_no_trailing_rotate_event` because it requires a different test setup, with access to the binlog files. - The test suite also skips `test_end_log_pos` for now, because it currently fails and the best solution wasn't obvious to me, the original author should have a look.
1 parent 0372035 commit 1376c6b

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

.github/workflows/pytest.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: PyTest
2+
on: push
3+
4+
jobs:
5+
test:
6+
runs-on: ubuntu-latest
7+
timeout-minutes: 2
8+
9+
steps:
10+
- name: Check out code
11+
uses: actions/checkout@v2
12+
13+
- name: Setup Python
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: "3.7"
17+
18+
- name: Run database server in docker
19+
run: |
20+
docker compose create
21+
docker compose start
22+
# Wait for the services to accept connections,
23+
# TODO: do that smarter, poll connection attempt until it succeeds
24+
sleep 30
25+
26+
- name: Install dependencies
27+
run: |
28+
pip install .
29+
pip install pytest
30+
31+
- name: Run test suite
32+
run: |
33+
pytest -k "not test_no_trailing_rotate_event and not test_end_log_pos"

docker-compose.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: '3.2'
2+
services:
3+
percona-5.7:
4+
image: percona:5.7
5+
environment:
6+
MYSQL_ALLOW_EMPTY_PASSWORD: true
7+
ports:
8+
- 3306:3306
9+
command: mysqld --log-bin=mysql-bin.log --server-id 1 --binlog-format=row --gtid_mode=on --enforce-gtid-consistency=on --log_slave_updates
10+
11+
percona-5.7-ctl:
12+
image: percona:5.7
13+
environment:
14+
MYSQL_ALLOW_EMPTY_PASSWORD: true
15+
ports:
16+
- 3307:3307
17+
command: mysqld --log-bin=mysql-bin.log --server-id 1 --binlog-format=row --gtid_mode=on --enforce-gtid-consistency=on --log_slave_updates -P 3307

0 commit comments

Comments
 (0)