File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,12 +35,12 @@ jobs:
3535 - name : Run unit & integration tests
3636 run : go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
3737
38+ - name : Run cluster chaos tests
39+ run : ./test-cluster-chaos.sh
40+
3841 - name : Upload coverage to Codecov
3942 uses : codecov/codecov-action@v4
4043 with :
4144 token : ${{ secrets.CODECOV_TOKEN }}
42- files : ./coverage.txt
45+ files : ./coverage.txt,./coverage-chaos.txt
4346 fail_ci_if_error : true
44-
45- - name : Run cluster chaos tests
46- run : ./test-cluster-chaos.sh
Original file line number Diff line number Diff line change 44* .pid
55tmp-node * .etcd /
66/default.etcd /
7+ /coverage- * .txt
8+ /coverage.txt
9+ /tmp-coverage /
710
811# Go binary and build files
912* .exe
Original file line number Diff line number Diff line change 22# test-cluster-chaos.sh - Automated 3-node etcd cluster chaos testing for conch
33set -euo pipefail
44
5+ export GOCOVERDIR=" ./tmp-coverage"
6+ rm -rf " $GOCOVERDIR "
7+ mkdir -p " $GOCOVERDIR "
8+
9+
510# Colors for log output
611RED=' \033[0;31m'
712GREEN=' \033[0;32m'
@@ -122,6 +127,12 @@ cleanup() {
122127 for port in 2379 2380 2381 2382 2383 2384; do
123128 fuser -k -n tcp " $port " & > /dev/null || true
124129 done
130+
131+ # Extract coverage data if any exists
132+ if [ -d " $GOCOVERDIR " ] && [ " $( ls -A " $GOCOVERDIR " ) " ]; then
133+ log " Generating binary coverage report from chaos tests..."
134+ go tool covdata textfmt -i=" $GOCOVERDIR " -o=coverage-chaos.txt
135+ fi
125136}
126137
127138# Delete data dirs and log files strictly on a fresh start
@@ -198,8 +209,8 @@ success "3-node etcd cluster is HEALTHY and clustered!"
198209" $ETCDCTL_BIN " --endpoints=127.0.0.1:2379 member list
199210
200211# Re-compile to ensure conch binary is up to date
201- log " Rebuilding conch binary..."
202- go build -o conch cmd/conch/main.go
212+ log " Rebuilding conch binary with coverage instrumentation ..."
213+ go build -cover - o conch cmd/conch/main.go
203214
204215# ---------------------------------------------------------
205216# Phase 1: Leadership Election with 3-node Consensus
You can’t perform that action at this time.
0 commit comments