Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyuhang0 committed Jul 14, 2023
1 parent 0efe1e7 commit eca4525
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions .github/workflows/connect-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Serverless Connect Test
name: Serverless Connect Test1

on:
schedule:
Expand All @@ -7,7 +7,7 @@ on:

jobs:
setup:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Checkout
Expand All @@ -24,9 +24,9 @@ jobs:
# delete all serverless
ticloud cluster list 1372813089447741295 -o json > cluster
total=$(jq '.total' cluster);
for i in {1..$total}
for i in $(seq 1 $total);
do
id=`echo $(jq '.items[$i-1].id' cluster) | sed 's/"//g'`
id=`echo $(jq ".items[$i-1].id" cluster) | sed 's/"//g'`
ticloud cluster delete -p 1372813089447741295 -c $id --force;
done
Expand All @@ -35,7 +35,7 @@ jobs:
strategy:
matrix:
region: [ us-east-1, us-west-2, ap-northeast-1, ap-southeast-1, eu-central-1 ]
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- name: Checkout
Expand All @@ -47,24 +47,23 @@ jobs:
api_public_key: ${{ secrets.CONNECT_PUBLIC_KEY }}
api_private_key: ${{ secrets.CONNECT_PRIVATE_KEY }}

- name: Set projectID
run: echo "::set-env name=PROJECT_ID::1372813089447741295"

- name: Create cluster
run: |
ticloud cluster create -p $PROJECT_ID --cluster-name ${{ matrix.region }} --cloud-provider AWS -r ${{ matrix.region }} --root-password ${{ secrets.TIDB_CLOUD_PASSWORD }} --cluster-type SERVERLESS > ${{ matrix.region }}
echo "::set-env name=CLUSTER_ID::`cat ${{ matrix.region }} | sed 's/[^0-9]//g'`"
ticloud cluster get -p $PROJECT_ID -c $CLUSTER_ID > ${{ matrix.region }}
PROJECT_ID=1372813089447741295
ticloud cluster create -p $PROJECT_ID --cluster-name ${{ matrix.region }} --cloud-provider AWS -r ${{ matrix.region }} --root-password ${{ secrets.TIDB_CLOUD_PASSWORD }} --cluster-type SERVERLESS > ${{ matrix.region }}
ticloud cluster get -p $PROJECT_ID -c `cat ${{ matrix.region }} | sed 's/[^0-9]//g'` > ${{ matrix.region }}
cat ${{ matrix.region }}
echo "::set-env name=CLUSTER_USER::(jq '.status.connection_strings.default_user' ${{ matrix.region }})"
echo "::set-env name=CLUSTER_HOST::(jq '.status.connection_strings.standard.host' ${{ matrix.region }})"
echo "PROJECT_ID=$PROJECT_ID" >> $GITHUB_ENV
echo "CLUSTER_ID=`echo $(jq '.id' ${{ matrix.region }}) | sed 's/"//g'`" >> $GITHUB_ENV
echo "CLUSTER_USER=$(jq '.status.connection_strings.default_user' ${{ matrix.region }})" >> $GITHUB_ENV
echo "CLUSTER_HOST=$(jq '.status.connection_strings.standard.host' ${{ matrix.region }})" >> $GITHUB_ENV
- name: Get mysql
- name: Setup mysql
uses: shogo82148/actions-setup-mysql@v1

- name: Run test
run: mysql -u $CLUSTER_USER -h $CLUSTER_HOST -P 4000 -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.TIDB_CLOUD_PASSWORD }}
run: mysql -u ${{ env.CLUSTER_USER }} -h ${{ env.CLUSTER_HOST }} -P 4000 -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/certs/ca-certificates.crt -p${{ secrets.TIDB_CLOUD_PASSWORD }}

- name: Delete cluster
run: |
ticloud cluster delete -p $PROJECT_ID -c $CLUSTER_ID --force
ticloud cluster delete -p ${{ env.PROJECT_ID }} -c ${{ env.CLUSTER_ID }} --force

0 comments on commit eca4525

Please sign in to comment.