Skip to content

Commit

Permalink
add Compatibility Test`
Browse files Browse the repository at this point in the history
  • Loading branch information
xuanyu66 committed Nov 16, 2023
1 parent 89b87aa commit ee0c7a1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/compatibility-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ jobs:
needs: setup
runs-on: ubuntu-22.04
timeout-minutes: 10
strategy:
matrix:
port: [ 4000, 3306 ]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -101,7 +104,7 @@ jobs:
uses: shogo82148/actions-setup-mysql@v1

- name: Run test
run: "! mysql -u ${{needs.setup.outputs.TIDB_CLOUD_USER}} -h ${{needs.setup.outputs.TIDB_CLOUD_HOST}} -P 4000 -D test --ssl-mode=DISABLED -p${{ secrets.TIDB_CLOUD_PASSWORD }}"
run: "! mysql -u ${{needs.setup.outputs.TIDB_CLOUD_USER}} -h ${{needs.setup.outputs.TIDB_CLOUD_HOST}} -P ${{ matrix.port }} -D test --ssl-mode=DISABLED -p${{ secrets.TIDB_CLOUD_PASSWORD }}"

invalid_tls_version:
needs: setup
Expand All @@ -110,6 +113,7 @@ jobs:
strategy:
matrix:
tls: [ TLSv1, TLSv1.1 ]
port: [ 4000, 3306 ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand All @@ -121,7 +125,7 @@ jobs:
# Starting from 8.0.26, TLSv1 & TLSv1.1 are deprecated. From 8.0.28, they are completely removed.
pip3 install mysql-connector-python==8.0.25
cd example_code/python
! python3 tls_version.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{secrets.TIDB_CLOUD_PASSWORD}} /etc/ssl/certs/ca-certificates.crt ${{ matrix.tls }}
! python3 tls_version.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{ matrix.port }} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{secrets.TIDB_CLOUD_PASSWORD}} /etc/ssl/certs/ca-certificates.crt ${{ matrix.tls }}
valid_tls_version:
needs: setup
Expand All @@ -130,6 +134,7 @@ jobs:
strategy:
matrix:
tls: [ TLSv1.2, TLSv1.3 ]
port: [ 4000, 3306 ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand All @@ -140,7 +145,7 @@ jobs:
run: |
pip3 install mysql-connector-python
cd example_code/python
python3 tls_version.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{secrets.TIDB_CLOUD_PASSWORD}} /etc/ssl/certs/ca-certificates.crt ${{ matrix.tls }}
python3 tls_version.py ${{needs.setup.outputs.TIDB_CLOUD_HOST}} ${{ matrix.port }} ${{needs.setup.outputs.TIDB_CLOUD_USER}} ${{secrets.TIDB_CLOUD_PASSWORD}} /etc/ssl/certs/ca-certificates.crt ${{ matrix.tls }}
mycli:
needs: setup
Expand Down
10 changes: 5 additions & 5 deletions example_code/python/tls_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import sys

connection = mysql.connector.connect(host=sys.argv[1],
user=sys.argv[2],
port= 4000,
password = sys.argv[3],
port=sys.argv[2],
user=sys.argv[3],
password = sys.argv[4],
database = 'test',
ssl_ca = sys.argv[4],
ssl_ca = sys.argv[5],
ssl_verify_identity = True,
tls_versions=[sys.argv[5]])
tls_versions=[sys.argv[6]])

cursor = connection.cursor()
cursor.execute("SHOW DATABASES")
Expand Down

0 comments on commit ee0c7a1

Please sign in to comment.