Skip cleaning up clusters in a failed state on Capella. #206
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
platform: [darwin, linux, windows] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: 1.21 | |
- name: Install dependencies | |
run: go get . | |
- name: Build Binary | |
run: GOOS=${{ matrix.platform }} GOARCH=amd64 go build -o cbdinocluster-${{ matrix.platform }} -ldflags="-X github.com/couchbaselabs/cbdinocluster/contrib/buildversion.MainPkgVersion=${{ github.sha }}" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: cbdinocluster-${{ matrix.platform }} | |
path: cbdinocluster-${{ matrix.platform }} | |
test: | |
name: Integration Test | |
needs: [build] | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: cbdinocluster-linux | |
- run: | | |
chmod +x cbdinocluster-linux | |
./cbdinocluster-linux init --auto | |
- name: Setup Cluster | |
run: | | |
CBDC_ID=$(./cbdinocluster-linux -v allocate simple:7.0.0) | |
echo "CBDC_ID=$CBDC_ID" >> "$GITHUB_ENV" | |
- name: Run Tests | |
timeout-minutes: 10 | |
run: | | |
# validate getting the connection string | |
./cbdinocluster-linux -v connstr $CBDC_ID | |
# validate getting management addresses | |
CBDC_MGMT=$(./cbdinocluster-linux -v mgmt $CBDC_ID) | |
echo $CBDC_MGMT | |
# validate cluster is accessible | |
curl $CBDC_MGMT | |
# pick a random node to mess with | |
NODE_IP=$(./cbdinocluster-linux -v ip $CBDC_ID) | |
# validate blocking traffic to the node | |
./cbdinocluster-linux -v chaos block-traffic $CBDC_ID $NODE_IP | |
# validate we can still access that node | |
curl http://$NODE_IP:8091 | |
# ensure we can unblock traffic | |
./cbdinocluster-linux -v chaos allow-traffic $CBDC_ID $NODE_IP | |
- name: Cleanup Cluster | |
if: always() | |
run: | | |
./cbdinocluster-linux rm $CBDC_ID |