Skip to content

Actions: Run auth tests #919

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

Merged
merged 3 commits into from
Jan 3, 2021
Merged
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
39 changes: 39 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,24 @@ jobs:
include:
- db: "mariadb:10.2"
py: "3.9"

- db: "mariadb:10.3"
py: "3.8"
mariadb_auth: true

- db: "mariadb:10.5"
py: "3.7"
mariadb_auth: true

- db: "mysql:5.6"
py: "3.6"

- db: "mysql:5.7"
py: "pypy-3.6"

- db: "mysql:8.0"
py: "3.9"
mysql_auth: true

services:
mysql:
Expand All @@ -48,10 +56,41 @@ jobs:
mysql -h 127.0.0.1 -uroot -e "create user test2 identified ${WITH_PLUGIN} by 'some password'; grant all on test2.* to test2;"
mysql -h 127.0.0.1 -uroot -e "create user test2@localhost identified ${WITH_PLUGIN} by 'some password'; grant all on test2.* to test2@localhost;"
cp .travis/docker.json pymysql/tests/databases.json

- name: Run test
run: |
pip install -U cryptography PyNaCl pytest pytest-cov mock coveralls
pytest -v --cov --cov-config .coveragerc pymysql

- name: Run MySQL8 auth test
if: ${{ matrix.mysql_auth }}
run: |
docker cp mysqld:/var/lib/mysql/public_key.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/ca.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/server-cert.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/client-key.pem "${HOME}"
docker cp mysqld:/var/lib/mysql/client-cert.pem "${HOME}"
mysql -uroot -h127.0.0.1 -e '
CREATE USER
user_sha256 IDENTIFIED WITH "sha256_password" BY "pass_sha256_01234567890123456789",
nopass_sha256 IDENTIFIED WITH "sha256_password",
user_caching_sha2 IDENTIFIED WITH "caching_sha2_password" BY "pass_caching_sha2_01234567890123456789",
nopass_caching_sha2 IDENTIFIED WITH "caching_sha2_password"
PASSWORD EXPIRE NEVER;
GRANT RELOAD ON *.* TO user_caching_sha2;'
pytest -v --cov --cov-config .coveragerc tests/test_auth.py;

- name: Run MariaDB auth test
if: ${{ matrix.mariadb_auth }}
run: |
mysql -uroot -h127.0.0.1 -e '
INSTALL SONAME "auth_ed25519";
CREATE FUNCTION ed25519_password RETURNS STRING SONAME "auth_ed25519.so";'
# we need to pass the hashed password manually until 10.4, so hide it here
mysql -uroot -h127.0.0.1 -sNe "SELECT CONCAT('CREATE USER nopass_ed25519 IDENTIFIED VIA ed25519 USING \"',ed25519_password(\"\"),'\";');" | mysql -uroot -h127.0.0.1
mysql -uroot -h127.0.0.1 -sNe "SELECT CONCAT('CREATE USER user_ed25519 IDENTIFIED VIA ed25519 USING \"',ed25519_password(\"pass_ed25519\"),'\";');" | mysql -uroot -h127.0.0.1
pytest -v --cov --cov-config .coveragerc tests/test_mariadb_auth.py

- name: Report coverage
run: coveralls
env:
Expand Down