-
Notifications
You must be signed in to change notification settings - Fork 5
64 lines (63 loc) · 2.08 KB
/
build-and-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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