Skip to content

Commit

Permalink
add create-test
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyuhang0 committed Jul 19, 2023
1 parent fd0034b commit 7dea857
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 72 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/compatibility-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ jobs:
run: |
# delete cluster if exists
ticloud cluster list 1372813089206721319 -o json > cluster
if [ $(jq '.total' cluster) == 1 ];
then
id=`echo $(jq '.items[0].id' cluster) | sed 's/"//g'`
ticloud cluster delete -p 1372813089206721319 -c $id --force;
total=$(jq '.total' cluster);
for i in $(seq 1 $total);
do
name=`echo $(jq ".items[$i-1].name" cluster)`
id=`echo $(jq ".items[$i-1].id" cluster) | sed 's/"//g'`
echo $name
echo $id
if [[ $name != *"connect-test"* ]]; then
ticloud cluster delete -p 1372813089206721319 -c $id --force;
fi
done
# create cluster
ticloud cluster create --project-id 1372813089206721319 --cluster-name tls-test --cloud-provider AWS -r us-east-1 --root-password ${{ secrets.TIDB_CLOUD_PASSWORD }} --cluster-type SERVERLESS;
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/connect-notify.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Serverless Connect Notify
name: Serverless Test Notify

on:
workflow_run:
workflows:
- "Serverless Connect Test"
- "Serverless Driver Compatibility Test"
- "Serverless Create Test"
types:
- completed

Expand Down
72 changes: 5 additions & 67 deletions .github/workflows/connect-test.yml
Original file line number Diff line number Diff line change
@@ -1,83 +1,21 @@
name: Serverless Connect Test
name: Serverless Connect Test1

on:
schedule:
- cron: "0/30 * * * *" # every 30 minutes
- cron: "0/5 * * * *" # every 5 minutes
workflow_dispatch:

jobs:
setup:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up ticloud
uses: tidbcloud/setup-tidbcloud-cli@v0
with:
api_public_key: ${{ secrets.CONNECT_PUBLIC_KEY }}
api_private_key: ${{ secrets.CONNECT_PRIVATE_KEY }}

- name: Delete all serverless
run: |
# delete all serverless
ticloud cluster list 1372813089447741295 -o json > cluster
total=$(jq '.total' cluster);
for i in $(seq 1 $total);
do
id=`echo $(jq ".items[$i-1].id" cluster) | sed 's/"//g'`
ticloud cluster delete -p 1372813089447741295 -c $id --force;
done
connect-test:
needs: setup
strategy:
matrix:
region: [ us-east-1, us-west-2, ap-northeast-1, ap-southeast-1, eu-central-1 ]
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 3
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up ticloud
uses: tidbcloud/setup-tidbcloud-cli@v0
with:
api_public_key: ${{ secrets.CONNECT_PUBLIC_KEY }}
api_private_key: ${{ secrets.CONNECT_PRIVATE_KEY }}

- name: Create cluster
run: |
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 }}
cat ${{ matrix.region }}
ticloud cluster get -p $PROJECT_ID -c `cat ${{ matrix.region }} | sed 's/[^0-9]//g'` > ${{ matrix.region }}
cat ${{ 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: Create branch
run: |
ticloud branch create -c ${{ env.CLUSTER_ID }} --branch-name ${{ matrix.region }} > ${{ matrix.region }}
cat ${{ matrix.region }}
ticloud branch get -c ${{ env.CLUSTER_ID }} -b `cat ${{ matrix.region }} | grep -o 'bran-[a-zA-Z0-9]*'` > ${{ matrix.region }}
cat ${{ matrix.region }}
echo "BRANCH_ID=`echo $(jq '.id' ${{ matrix.region }}) | sed 's/"//g'`" >> $GITHUB_ENV
echo "BRANCH_USER=$(jq '.user_prefix' ${{ matrix.region }})".root"" >> $GITHUB_ENV
echo "BRANCH_HOST=$(jq '.endpoints.public_endpoint.host' ${{ matrix.region }})" >> $GITHUB_ENV
- name: Setup mysql
uses: shogo82148/actions-setup-mysql@v1

- name: Run test
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 & branch
- name: connect
run: |
ticloud branch delete -c ${{ env.CLUSTER_ID }} -b ${{ env.BRANCH_ID }} --force
ticloud cluster delete -p ${{ env.PROJECT_ID }} -c ${{ env.CLUSTER_ID }} --force
mysql -u '4TNwCHfJvXJxs4v.root' -h gateway01.eu-central-1.prod.aws.tidbcloud.com -P 4000 -D test --ssl-mode=VERIFY_IDENTITY --ssl-ca=/etc/ssl/cert.pem -p${{ secrets.CONNECT_TEST_PSWD }}
83 changes: 83 additions & 0 deletions .github/workflows/create-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Serverless Create Test

on:
schedule:
- cron: "0/30 * * * *" # every 30 minutes
workflow_dispatch:

jobs:
setup:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up ticloud
uses: tidbcloud/setup-tidbcloud-cli@v0
with:
api_public_key: ${{ secrets.CONNECT_PUBLIC_KEY }}
api_private_key: ${{ secrets.CONNECT_PRIVATE_KEY }}

- name: Delete all serverless
run: |
# delete all serverless
ticloud cluster list 1372813089447741295 -o json > cluster
total=$(jq '.total' cluster);
for i in $(seq 1 $total);
do
id=`echo $(jq ".items[$i-1].id" cluster) | sed 's/"//g'`
ticloud cluster delete -p 1372813089447741295 -c $id --force;
done
connect-test:
needs: setup
strategy:
matrix:
region: [ us-east-1, us-west-2, ap-northeast-1, ap-southeast-1, eu-central-1 ]
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up ticloud
uses: tidbcloud/setup-tidbcloud-cli@v0
with:
api_public_key: ${{ secrets.CONNECT_PUBLIC_KEY }}
api_private_key: ${{ secrets.CONNECT_PRIVATE_KEY }}

- name: Create cluster
run: |
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 }}
cat ${{ matrix.region }}
ticloud cluster get -p $PROJECT_ID -c `cat ${{ matrix.region }} | sed 's/[^0-9]//g'` > ${{ matrix.region }}
cat ${{ 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: Create branch
run: |
ticloud branch create -c ${{ env.CLUSTER_ID }} --branch-name ${{ matrix.region }} > ${{ matrix.region }}
cat ${{ matrix.region }}
ticloud branch get -c ${{ env.CLUSTER_ID }} -b `cat ${{ matrix.region }} | grep -o 'bran-[a-zA-Z0-9]*'` > ${{ matrix.region }}
cat ${{ matrix.region }}
echo "BRANCH_ID=`echo $(jq '.id' ${{ matrix.region }}) | sed 's/"//g'`" >> $GITHUB_ENV
echo "BRANCH_USER=$(jq '.user_prefix' ${{ matrix.region }})".root"" >> $GITHUB_ENV
echo "BRANCH_HOST=$(jq '.endpoints.public_endpoint.host' ${{ matrix.region }})" >> $GITHUB_ENV
- name: Setup mysql
uses: shogo82148/actions-setup-mysql@v1

- name: Run test
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 & branch
run: |
ticloud branch delete -c ${{ env.CLUSTER_ID }} -b ${{ env.BRANCH_ID }} --force
ticloud cluster delete -p ${{ env.PROJECT_ID }} -c ${{ env.CLUSTER_ID }} --force

0 comments on commit 7dea857

Please sign in to comment.