Skip to content

Commit 23b6080

Browse files
Brett Lawsonbrett19
authored andcommitted
ING-695: Use cbdinocluster for test cluster creation.
1 parent 00ea9fb commit 23b6080

File tree

3 files changed

+43
-258
lines changed

3 files changed

+43
-258
lines changed

.github/bin/check-cluster

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/bin/init-cluster

Lines changed: 0 additions & 212 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,35 @@ jobs:
1515
server:
1616
- 7.2.2
1717
runs-on: ubuntu-latest
18-
services:
19-
couchbase:
20-
image: couchbase:enterprise-${{ matrix.server }}
21-
ports:
22-
- 8091-8096:8091-8096
23-
- 18091-18096:18091-18096
24-
- 11210:11210
25-
- 11207:11207
2618
steps:
19+
- name: Install cbdinocluster
20+
run: |
21+
mkdir -p "$HOME/bin"
22+
wget -nv -O $HOME/bin/cbdinocluster https://github.com/couchbaselabs/cbdinocluster/releases/download/v0.0.79/cbdinocluster-linux-amd64
23+
chmod +x $HOME/bin/cbdinocluster
24+
echo "$HOME/bin" >> $GITHUB_PATH
25+
- name: Initialize cbdinocluster
26+
run: |
27+
cbdinocluster -v init --auto
28+
- name: Start couchbase cluster
29+
env:
30+
CLUSTERCONFIG: |
31+
nodes:
32+
- count: 3
33+
version: ${{ matrix.server }}
34+
services: [kv, n1ql, index, fts, cbas]
35+
docker:
36+
kv-memory: 2048
37+
run: |
38+
CBDC_ID=$(cbdinocluster -v alloc --def="${CLUSTERCONFIG}")
39+
cbdinocluster -v buckets add ${CBDC_ID} default --ram-quota-mb=100 --flush-enabled=true --num-replicas=2
40+
cbdinocluster -v collections add ${CBDC_ID} default _default test
41+
# we ignore errors here because the indexer might fail this with a 'automatically trying again later'
42+
cbdinocluster -v query ${CBDC_ID} "CREATE PRIMARY INDEX ON default" || true
43+
CBDC_IP=$(cbdinocluster -v ip $CBDC_ID)
44+
echo "CBDC_ID=$CBDC_ID" >> "$GITHUB_ENV"
45+
echo "CBDC_IP=$CBDC_IP" >> "$GITHUB_ENV"
46+
2747
- uses: actions/checkout@v4
2848
with:
2949
submodules: recursive
@@ -44,15 +64,22 @@ jobs:
4464
- name: Generate Files
4565
run: |
4666
go generate ./...
47-
- name: Initialize Test Cluster
48-
run: ./.github/bin/init-cluster
49-
- name: Check Test Cluster
50-
run: ./.github/bin/check-cluster
51-
- name: Setup Cluster
52-
run: |
53-
curl -X POST -u Administrator:password http://127.0.0.1:8091/pools/default/buckets/default/scopes/_default/collections -d name=test
5467
- name: Run Tests
5568
timeout-minutes: 10
5669
env:
57-
SGTEST_CBCONNSTR: 127.0.0.1
70+
SGTEST_CBCONNSTR: ${{ env.CBDC_IP }}
5871
run: go test -v $(go list ./... | grep -v /contrib/)
72+
73+
- name: Collect couchbase logs
74+
timeout-minutes: 10
75+
if: failure()
76+
run: |
77+
mkdir -p ./logs
78+
cbdinocluster -v collect-logs $CBDC_ID ./logs
79+
- name: Upload couchbase logs
80+
if: failure()
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: cbcollect-logs
84+
path: ./logs/*
85+
retention-days: 5

0 commit comments

Comments
 (0)