mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
tests: Cleanup gofail
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
This commit is contained in:
parent
cdb9b8b2a0
commit
dd4d69ca91
4
.github/workflows/linearizability.yaml
vendored
4
.github/workflows/linearizability.yaml
vendored
@ -9,9 +9,9 @@ jobs:
|
||||
with:
|
||||
go-version: "1.19.3"
|
||||
- run: |
|
||||
pushd tools/mod; go install go.etcd.io/gofail; popd
|
||||
make gofail-enable
|
||||
make build
|
||||
mkdir -p /tmp/linearizability
|
||||
FAILPOINTS=true make build
|
||||
cat server/etcdserver/raft.fail.go
|
||||
EXPECT_DEBUG=true GO_TEST_FLAGS=-v RESULTS_DIR=/tmp/linearizability make test-linearizability
|
||||
- uses: actions/upload-artifact@v2
|
||||
|
25
Makefile
25
Makefile
@ -31,7 +31,7 @@ test-e2e-release: build
|
||||
|
||||
.PHONY: test-linearizability
|
||||
test-linearizability:
|
||||
FAILPOINTS=true PASSES="linearizability" ./scripts/test.sh $(GO_TEST_FLAGS)
|
||||
PASSES="linearizability" ./scripts/test.sh $(GO_TEST_FLAGS)
|
||||
|
||||
.PHONY: fuzz
|
||||
fuzz:
|
||||
@ -105,6 +105,29 @@ verify-proto-annotations:
|
||||
verify-genproto:
|
||||
PASSES="genproto" ./scripts/test.sh
|
||||
|
||||
# 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/storage/backend/ server/storage/mvcc/
|
||||
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/storage/backend/ server/storage/mvcc/
|
||||
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}
|
||||
|
||||
# Cleanup
|
||||
|
||||
|
@ -3,10 +3,6 @@
|
||||
source ./scripts/test_lib.sh
|
||||
|
||||
GIT_SHA=$(git rev-parse --short HEAD || echo "GitNotFound")
|
||||
if [[ -n "$FAILPOINTS" ]]; then
|
||||
GIT_SHA="$GIT_SHA"-FAILPOINTS
|
||||
fi
|
||||
|
||||
VERSION_SYMBOL="${ROOT_MODULE}/api/v3/version.GitSHA"
|
||||
|
||||
# Set GO_LDFLAGS="-s" for building without symbols for debugging.
|
||||
@ -14,45 +10,9 @@ VERSION_SYMBOL="${ROOT_MODULE}/api/v3/version.GitSHA"
|
||||
GO_LDFLAGS=(${GO_LDFLAGS} "-X=${VERSION_SYMBOL}=${GIT_SHA}")
|
||||
GO_BUILD_ENV=("CGO_ENABLED=0" "GO_BUILD_FLAGS=${GO_BUILD_FLAGS}" "GOOS=${GOOS}" "GOARCH=${GOARCH}")
|
||||
|
||||
# enable/disable failpoints
|
||||
toggle_failpoints() {
|
||||
mode="$1"
|
||||
if command -v gofail >/dev/null 2>&1; then
|
||||
run gofail "$mode" server/etcdserver/ server/storage/backend/ server/storage/mvcc/
|
||||
if [[ "$mode" == "enable" ]]; then
|
||||
(
|
||||
cd ./server
|
||||
run go get go.etcd.io/gofail/runtime
|
||||
) || exit 2
|
||||
(
|
||||
cd ./etcdutl
|
||||
run go get go.etcd.io/gofail/runtime
|
||||
) || exit 2
|
||||
(
|
||||
cd ./etcdctl
|
||||
run go get go.etcd.io/gofail/runtime
|
||||
) || exit 2
|
||||
(
|
||||
cd ./tests
|
||||
run go get go.etcd.io/gofail/runtime
|
||||
) || exit 2
|
||||
fi
|
||||
elif [[ "$mode" != "disable" ]]; then
|
||||
log_error "FAILPOINTS set but gofail not found"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
toggle_failpoints_default() {
|
||||
mode="disable"
|
||||
if [[ -n "$FAILPOINTS" ]]; then mode="enable"; fi
|
||||
toggle_failpoints "$mode"
|
||||
}
|
||||
|
||||
etcd_build() {
|
||||
out="bin"
|
||||
if [[ -n "${BINDIR}" ]]; then out="${BINDIR}"; fi
|
||||
toggle_failpoints_default
|
||||
|
||||
run rm -f "${out}/etcd"
|
||||
(
|
||||
@ -138,5 +98,3 @@ run_build() {
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
||||
toggle_failpoints_default
|
||||
|
@ -15,7 +15,7 @@ require (
|
||||
github.com/mdempsky/unconvert v0.0.0-20200228143138-95ecdbfc0b5f
|
||||
github.com/mgechev/revive v1.2.1
|
||||
github.com/mikefarah/yq/v4 v4.24.2
|
||||
go.etcd.io/gofail v0.0.0-20221118034130-cb2ba30a3077
|
||||
go.etcd.io/gofail v0.0.0-20221125214112-fc21f61ba88a
|
||||
go.etcd.io/protodoc v0.0.0-20180829002748-484ab544e116
|
||||
gotest.tools/gotestsum v1.7.0
|
||||
gotest.tools/v3 v3.1.0
|
||||
@ -84,5 +84,5 @@ require (
|
||||
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884 // indirect
|
||||
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
@ -220,8 +220,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
|
||||
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||
github.com/timtadh/data-structures v0.5.3 h1:F2tEjoG9qWIyUjbvXVgJqEOGJPMIiYn7U5W5mE+i/vQ=
|
||||
@ -238,8 +238,8 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
go.etcd.io/gofail v0.0.0-20221118034130-cb2ba30a3077 h1:MCsm8Jg7+oqah8R9ylGiWTt3EV3InfPgxNb6SLKngwA=
|
||||
go.etcd.io/gofail v0.0.0-20221118034130-cb2ba30a3077/go.mod h1:bOzzUWJ5bNHifkNkoIN6Ydf/z/UPT0bYuPghFYVC8+4=
|
||||
go.etcd.io/gofail v0.0.0-20221125214112-fc21f61ba88a h1:+VXd5SHsxTf5hPVx4YsE358CqkDA0SCM1L7HWlhQ2Z0=
|
||||
go.etcd.io/gofail v0.0.0-20221125214112-fc21f61ba88a/go.mod h1:VZBCXYGZhHAinaBiiqYvuDynvahNsAyLFwB3kEHKz1M=
|
||||
go.etcd.io/protodoc v0.0.0-20180829002748-484ab544e116 h1:QQiUXlqz+d96jyNG71NE+IGTgOK6Xlhdx+PzvfbLHlQ=
|
||||
go.etcd.io/protodoc v0.0.0-20180829002748-484ab544e116/go.mod h1:F9kog+iVAuvPJucb1dkYcDcbV0g4uyGEHllTP5NrXiw=
|
||||
go.mongodb.org/mongo-driver v1.7.3 h1:G4l/eYY9VrQAK/AUgkV0koQKzQnyddnWxrd/Etf0jIs=
|
||||
@ -375,8 +375,9 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gotest.tools/gotestsum v1.7.0 h1:RwpqwwFKBAa2h+F6pMEGpE707Edld0etUD3GhqqhDNc=
|
||||
gotest.tools/gotestsum v1.7.0/go.mod h1:V1m4Jw3eBerhI/A6qCxUE07RnCg7ACkKj9BYcAm09V8=
|
||||
gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8=
|
||||
|
Loading…
x
Reference in New Issue
Block a user