Skip to content

Commit b93a87a

Browse files
authored
Actions: Run auth tests (PyMySQL#919)
1 parent 6ec449a commit b93a87a

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/test.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,24 @@ jobs:
1212
include:
1313
- db: "mariadb:10.2"
1414
py: "3.9"
15+
1516
- db: "mariadb:10.3"
1617
py: "3.8"
18+
mariadb_auth: true
19+
1720
- db: "mariadb:10.5"
1821
py: "3.7"
22+
mariadb_auth: true
23+
1924
- db: "mysql:5.6"
2025
py: "3.6"
26+
2127
- db: "mysql:5.7"
2228
py: "pypy-3.6"
29+
2330
- db: "mysql:8.0"
2431
py: "3.9"
32+
mysql_auth: true
2533

2634
services:
2735
mysql:
@@ -48,10 +56,41 @@ jobs:
4856
mysql -h 127.0.0.1 -uroot -e "create user test2 identified ${WITH_PLUGIN} by 'some password'; grant all on test2.* to test2;"
4957
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;"
5058
cp .travis/docker.json pymysql/tests/databases.json
59+
5160
- name: Run test
5261
run: |
5362
pip install -U cryptography PyNaCl pytest pytest-cov mock coveralls
5463
pytest -v --cov --cov-config .coveragerc pymysql
64+
65+
- name: Run MySQL8 auth test
66+
if: ${{ matrix.mysql_auth }}
67+
run: |
68+
docker cp mysqld:/var/lib/mysql/public_key.pem "${HOME}"
69+
docker cp mysqld:/var/lib/mysql/ca.pem "${HOME}"
70+
docker cp mysqld:/var/lib/mysql/server-cert.pem "${HOME}"
71+
docker cp mysqld:/var/lib/mysql/client-key.pem "${HOME}"
72+
docker cp mysqld:/var/lib/mysql/client-cert.pem "${HOME}"
73+
mysql -uroot -h127.0.0.1 -e '
74+
CREATE USER
75+
user_sha256 IDENTIFIED WITH "sha256_password" BY "pass_sha256_01234567890123456789",
76+
nopass_sha256 IDENTIFIED WITH "sha256_password",
77+
user_caching_sha2 IDENTIFIED WITH "caching_sha2_password" BY "pass_caching_sha2_01234567890123456789",
78+
nopass_caching_sha2 IDENTIFIED WITH "caching_sha2_password"
79+
PASSWORD EXPIRE NEVER;
80+
GRANT RELOAD ON *.* TO user_caching_sha2;'
81+
pytest -v --cov --cov-config .coveragerc tests/test_auth.py;
82+
83+
- name: Run MariaDB auth test
84+
if: ${{ matrix.mariadb_auth }}
85+
run: |
86+
mysql -uroot -h127.0.0.1 -e '
87+
INSTALL SONAME "auth_ed25519";
88+
CREATE FUNCTION ed25519_password RETURNS STRING SONAME "auth_ed25519.so";'
89+
# we need to pass the hashed password manually until 10.4, so hide it here
90+
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
91+
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
92+
pytest -v --cov --cov-config .coveragerc tests/test_mariadb_auth.py
93+
5594
- name: Report coverage
5695
run: coveralls
5796
env:

0 commit comments

Comments
 (0)