Skip to content

Commit

Permalink
Run tests as GitHub Actions (julien-duponchelle#376)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
oseemann authored Apr 22, 2022
1 parent 0372035 commit 1376c6b
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: PyTest
on: push

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 2

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.7"

- name: Run database server in docker
run: |
docker compose create
docker compose start
# Wait for the services to accept connections,
# TODO: do that smarter, poll connection attempt until it succeeds
sleep 30
- name: Install dependencies
run: |
pip install .
pip install pytest
- name: Run test suite
run: |
pytest -k "not test_no_trailing_rotate_event and not test_end_log_pos"
17 changes: 17 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3.2'
services:
percona-5.7:
image: percona:5.7
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: true
ports:
- 3306:3306
command: mysqld --log-bin=mysql-bin.log --server-id 1 --binlog-format=row --gtid_mode=on --enforce-gtid-consistency=on --log_slave_updates

percona-5.7-ctl:
image: percona:5.7
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: true
ports:
- 3307:3307
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 comments on commit 1376c6b

Please sign in to comment.