Skip to content

Commit

Permalink
Connect test on 3306 (#50)
Browse files Browse the repository at this point in the history
* test on 3306
  • Loading branch information
xuanyu66 authored Nov 16, 2023
1 parent ae764e7 commit 6172108
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 18 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
35 changes: 25 additions & 10 deletions .github/workflows/connect-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
jobs:
us-east-1:
runs-on: ubuntu-latest
strategy:
matrix:
port: [4000, 3306]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -17,12 +20,15 @@ jobs:

- name: connect cluster us-east-1
run: |
mysql --connect-timeout 15 -u 'nADWvyBQFXhgZxw.root' -h gateway01.us-east-1.prod.aws.tidbcloud.com -P 4000 -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.TIDB_CLOUD_PASSWORD }}
mysql --connect-timeout 15 -u 'nADWvyBQFXhgZxw.root' -h gateway01.us-east-1.prod.aws.tidbcloud.com -P ${{ matrix.port }} -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.TIDB_CLOUD_PASSWORD }}
- name: connect branch us-east-1
run: |
mysql --connect-timeout 15 -u '4ZT7LxxVy4JJoaH.root' -h gateway01.us-east-1.prod.aws.tidbcloud.com -P 4000 -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.BRANCH_PSWD_US_EAST_1 }}
mysql --connect-timeout 15 -u '4ZT7LxxVy4JJoaH.root' -h gateway01.us-east-1.prod.aws.tidbcloud.com -P ${{ matrix.port }} -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.BRANCH_PSWD_US_EAST_1 }}
us-west-2:
strategy:
matrix:
port: [ 4000, 3306 ]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -33,12 +39,15 @@ jobs:

- name: connect cluster us-west-2
run: |
mysql --connect-timeout 15 -u 'j24i5KNxRJpvEj7.root' -h gateway01.us-west-2.prod.aws.tidbcloud.com -P 4000 -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.TIDB_CLOUD_PASSWORD }}
mysql --connect-timeout 15 -u 'j24i5KNxRJpvEj7.root' -h gateway01.us-west-2.prod.aws.tidbcloud.com -P ${{ matrix.port }} -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.TIDB_CLOUD_PASSWORD }}
- name: connect branch us-west-2
run: |
mysql --connect-timeout 15 -u '23MRMbs1xyFmALz.root' -h gateway01.us-west-2.prod.aws.tidbcloud.com -P 4000 -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.BRANCH_PSWD_US_WEST_2 }}
mysql --connect-timeout 15 -u '23MRMbs1xyFmALz.root' -h gateway01.us-west-2.prod.aws.tidbcloud.com -P ${{ matrix.port }} -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.BRANCH_PSWD_US_WEST_2 }}
ap-northeast-1:
strategy:
matrix:
port: [ 4000, 3306 ]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -49,13 +58,16 @@ jobs:

- name: connect cluster ap-northeast-1
run: |
mysql --connect-timeout 15 -u 'Nv7fzTqtB8V698S.root' -h gateway01.ap-northeast-1.prod.aws.tidbcloud.com -P 4000 -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.TIDB_CLOUD_PASSWORD }}
mysql --connect-timeout 15 -u 'Nv7fzTqtB8V698S.root' -h gateway01.ap-northeast-1.prod.aws.tidbcloud.com -P ${{ matrix.port }} -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.TIDB_CLOUD_PASSWORD }}
- name: connect branch ap-northeast-1
run: |
mysql --connect-timeout 15 -u '3JwPQ7c8B1Bva6f.root' -h gateway01.ap-northeast-1.prod.aws.tidbcloud.com -P 4000 -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.BRANCH_PSWD_AP_NORTHEAST_1 }}
mysql --connect-timeout 15 -u '3JwPQ7c8B1Bva6f.root' -h gateway01.ap-northeast-1.prod.aws.tidbcloud.com -P ${{ matrix.port }} -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.BRANCH_PSWD_AP_NORTHEAST_1 }}
ap-southeast-1:
strategy:
matrix:
port: [ 4000, 3306 ]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -66,13 +78,16 @@ jobs:

- name: connect cluster ap-southeast-1
run: |
mysql --connect-timeout 15 -u 'eQsaVQSBNukNp7k.root' -h gateway01.ap-southeast-1.prod.aws.tidbcloud.com -P 4000 -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.TIDB_CLOUD_PASSWORD }}
mysql --connect-timeout 15 -u 'eQsaVQSBNukNp7k.root' -h gateway01.ap-southeast-1.prod.aws.tidbcloud.com -P ${{ matrix.port }} -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.TIDB_CLOUD_PASSWORD }}
- name: connect branch ap-southeast-1
run: |
mysql --connect-timeout 15 -u 'pSs1wenmQSbzevk.root' -h gateway01.ap-southeast-1.prod.aws.tidbcloud.com -P 4000 -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.BRANCH_PSWD_AP_SOUTHEAST_1 }}
mysql --connect-timeout 15 -u 'pSs1wenmQSbzevk.root' -h gateway01.ap-southeast-1.prod.aws.tidbcloud.com -P ${{ matrix.port }} -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.BRANCH_PSWD_AP_SOUTHEAST_1 }}
eu-central-1:
strategy:
matrix:
port: [ 4000, 3306 ]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -83,11 +98,11 @@ jobs:

- name: connect cluster eu-central-1
run: |
mysql --connect-timeout 15 -u 'Bxoh2PviimqNru3.root' -h gateway01.eu-central-1.prod.aws.tidbcloud.com -P 4000 -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.CLUSTER_PSWD_EU_CENTRAL_1 }}
mysql --connect-timeout 15 -u 'Bxoh2PviimqNru3.root' -h gateway01.eu-central-1.prod.aws.tidbcloud.com -P ${{ matrix.port }} -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.CLUSTER_PSWD_EU_CENTRAL_1 }}
- name: connect branch eu-central-1
run: |
mysql --connect-timeout 15 -u '3qcaCc1BYPFFUqV.root' -h gateway01.eu-central-1.prod.aws.tidbcloud.com -P 4000 -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.BRANCH_PSWD_EU_CENTRAL_1 }}
mysql --connect-timeout 15 -u '3qcaCc1BYPFFUqV.root' -h gateway01.eu-central-1.prod.aws.tidbcloud.com -P ${{ matrix.port }} -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.BRANCH_PSWD_EU_CENTRAL_1 }}
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 6172108

Please sign in to comment.