Skip to content

Commit

Permalink
test: enable gofail in release e2e test.
Browse files Browse the repository at this point in the history
Signed-off-by: Siyuan Zhang <sizhang@google.com>
  • Loading branch information
siyuanfoundation committed Dec 8, 2023
1 parent b8d5e79 commit dc79aec
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ jobs:
echo "${TARGET}"
case "${TARGET}" in
linux-amd64-e2e)
CPU='4' EXPECT_DEBUG='true' COVER='false' RACE='true' make test-e2e-release
make gofail-enable
CPU='4' EXPECT_DEBUG='true' COVER='false' RACE='true' FAILPOINTS='true' make test-e2e-release
;;
linux-386-e2e)
GOARCH=386 CPU='4' EXPECT_DEBUG='true' COVER='false' RACE='true' make test-e2e
Expand Down
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -565,3 +565,29 @@ pull-docker-functional:
$(info GO_VERSION: $(GO_VERSION))
$(info ETCD_VERSION: $(ETCD_VERSION))
docker pull gcr.io/etcd-development/etcd-functional:go$(GO_VERSION)

# Failpoints

GOFAIL_VERSION = $(shell cd tools/mod && go list -m -f {{.Version}} go.etcd.io/gofail)

.PHONY: gofail-enable
gofail-enable: install-gofail
gofail enable server/etcdserver/ server/mvcc/ server/wal/ server/mvcc/backend/
go get go.etcd.io/gofail@${GOFAIL_VERSION}
cd ./server && go get go.etcd.io/gofail@${GOFAIL_VERSION}
cd ./etcdutl && go get go.etcd.io/gofail@${GOFAIL_VERSION}
cd ./etcdctl && go get go.etcd.io/gofail@${GOFAIL_VERSION}
cd ./tests && go get go.etcd.io/gofail@${GOFAIL_VERSION}

.PHONY: gofail-disable
gofail-disable: install-gofail
gofail disable server/etcdserver/ server/mvcc/ server/wal/ server/mvcc/backend/
go mod tidy
cd ./server && go mod tidy
cd ./etcdutl && go mod tidy
cd ./etcdctl && go mod tidy
cd ./tests && go mod tidy

.PHONY: install-gofail
install-gofail:
cd tools/mod; go install go.etcd.io/gofail@${GOFAIL_VERSION}
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ GO_BUILD_ENV=("CGO_ENABLED=0" "GO_BUILD_FLAGS=${GO_BUILD_FLAGS:-}" "GOOS=${GOOS}
toggle_failpoints() {
mode="$1"
if command -v gofail >/dev/null 2>&1; then
run gofail "$mode" server/etcdserver/ server/mvcc/backend/ server/wal/
run gofail "$mode" server/etcdserver/ server/mvcc/ server/wal/ server/mvcc/backend/
elif [[ "$mode" != "disable" ]]; then
log_error "FAILPOINTS set but gofail not found"
exit 1
Expand Down
1 change: 1 addition & 0 deletions tools/mod/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ require (
github.com/mgechev/revive v1.0.2
github.com/mikefarah/yq/v3 v3.0.0-20201125113350-f42728eef735
github.com/trustmaster/go-aspell v0.0.0-20200701131845-c2b1f55bec8f // indirect
go.etcd.io/gofail v0.1.0
go.etcd.io/protodoc v0.0.0-20180829002748-484ab544e116
google.golang.org/genproto v0.0.0-20201008135153-289734e2e40c // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
Expand Down
1 change: 1 addition & 0 deletions tools/mod/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
_ "github.com/mdempsky/unconvert"
_ "github.com/mgechev/revive"
_ "github.com/mikefarah/yq/v3"
_ "go.etcd.io/gofail"
_ "go.etcd.io/protodoc"
_ "honnef.co/go/tools/cmd/staticcheck"
_ "mvdan.cc/unparam"
Expand Down

0 comments on commit dc79aec

Please sign in to comment.