From b78b21405db22bda54a7c95386959c3f7eba8bf8 Mon Sep 17 00:00:00 2001 From: Wei Fu Date: Thu, 4 Apr 2024 14:50:00 +0800 Subject: [PATCH] .github: enable failpoints for integration tests And introduce helper to toggle failpoints by makefile. Signed-off-by: Wei Fu --- .github/workflows/tests-template.yaml | 9 ++++++--- Makefile | 10 +++++++++- test.sh | 4 ++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests-template.yaml b/.github/workflows/tests-template.yaml index d0caacfec..2b5af12c4 100644 --- a/.github/workflows/tests-template.yaml +++ b/.github/workflows/tests-template.yaml @@ -41,13 +41,16 @@ jobs: GOARCH=${{ inputs.arch }} CPU=4 RACE='false' make test-smoke ;; linux-integration-1-cpu) - GOARCH=${{ inputs.arch }} CPU=1 RACE='false' make test-integration + make install-gofail + GOARCH=${{ inputs.arch }} CPU=1 RACE='false' FAILPOINTS='true' make test-integration ;; linux-integration-2-cpu) - GOARCH=${{ inputs.arch }} CPU=2 RACE='false' make test-integration + make install-gofail + GOARCH=${{ inputs.arch }} CPU=2 RACE='false' FAILPOINTS='true' make test-integration ;; linux-integration-4-cpu) - GOARCH=${{ inputs.arch }} CPU=4 RACE='false' make test-integration + make install-gofail + GOARCH=${{ inputs.arch }} CPU=4 RACE='false' FAILPOINTS='true' make test-integration ;; linux-unit-4-cpu-race) GOARCH=${{ inputs.arch }} RACE='true' CPU='4' GO_TEST_FLAGS='-p=2' make test-unit diff --git a/Makefile b/Makefile index 78fb0fe37..b3f326827 100644 --- a/Makefile +++ b/Makefile @@ -571,4 +571,12 @@ pull-docker-functional: GOFAIL_VERSION = $(shell cd tools/mod && go list -m -f {{.Version}} go.etcd.io/gofail) .PHONY: install-gofail install-gofail: - go install go.etcd.io/gofail@${GOFAIL_VERSION} \ No newline at end of file + go install go.etcd.io/gofail@${GOFAIL_VERSION} + +.PHONY: gofail-enable +gofail-enable: install-gofail + PASSES="toggle_failpoints" FAILPOINTS=true ./test.sh + +.PHONY: gofail-disable +gofail-disable: install-gofail + PASSES="toggle_failpoints" ./test.sh diff --git a/test.sh b/test.sh index efa2682c6..a9c883e04 100755 --- a/test.sh +++ b/test.sh @@ -709,6 +709,10 @@ function mod_tidy_pass { run_for_modules mod_tidy_for_module } +function toggle_failpoints_pass { + toggle_failpoints_default +} + ########### MAIN ############################################################### function run_pass {