From bb506068273e15af45d6a99fe2d6df8557791374 Mon Sep 17 00:00:00 2001 From: geray <919179287@qq.com> Date: Wed, 30 Aug 2023 12:23:58 +0800 Subject: [PATCH] test: fix failpoint Signed-off-by: <919179287@qq.com> --- .github/workflows/cluster_endtoend_mysqltester.yml | 2 +- .github/workflows/unit_test_mysql57.yml | 6 +++++- go/vt/vtgate/failpoint_test.go | 2 +- test/failpoint/failpoints.sh | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cluster_endtoend_mysqltester.yml b/.github/workflows/cluster_endtoend_mysqltester.yml index 0aa3093977..a3955fe5e5 100644 --- a/.github/workflows/cluster_endtoend_mysqltester.yml +++ b/.github/workflows/cluster_endtoend_mysqltester.yml @@ -99,7 +99,7 @@ jobs: DOCKER_BUILDKIT=0 docker build docker/wesqlscale/local/ -t apecloud/mysql-tester # failpoint - chmod 755 ./test/failpoint/failpoints.sh && ./test/failpoint/failpoints.sh + chmod 755 ./test/failpoint/failpoints.sh && source ./test/failpoint/failpoints.sh echo "GO_FAILPOINTS=$GO_FAILPOINTS" >> $GITHUB_OUTPUT # run container diff --git a/.github/workflows/unit_test_mysql57.yml b/.github/workflows/unit_test_mysql57.yml index eafdc3c4bc..e75065f346 100644 --- a/.github/workflows/unit_test_mysql57.yml +++ b/.github/workflows/unit_test_mysql57.yml @@ -131,8 +131,12 @@ jobs: if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.unit_tests == 'true' timeout-minutes: 30 run: | - + # failpoint + chmod 755 ./test/failpoint/failpoints.sh && source ./test/failpoint/failpoints.sh + echo "GO_FAILPOINTS=$GO_FAILPOINTS" >> $GITHUB_OUTPUT + make failpoint-enable eatmydata -- make unit_test | tee -a output.txt | go-junit-report -set-exit-code > report.xml + make failpoint-disable - name: Print test output and Record test result if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.unit_tests == 'true' && always() diff --git a/go/vt/vtgate/failpoint_test.go b/go/vt/vtgate/failpoint_test.go index 9293e40020..edc0663d20 100644 --- a/go/vt/vtgate/failpoint_test.go +++ b/go/vt/vtgate/failpoint_test.go @@ -22,7 +22,7 @@ func GetValueOfFailPoint(fpName string) failpoint.Value { } func TestFailpointEnable(t *testing.T) { - failpoint.Enable("vitess.io/vitess/go/vt/vtgate/testPanic", "return(1)") + //failpoint.Enable("vitess.io/vitess/go/vt/vtgate/testPanic", "return(1)") fmt.Println("testPanic", GetValueOfFailPoint("testPanic")) assert.Equal(t, 0, GetValueOfFailPoint("testPanic")) } diff --git a/test/failpoint/failpoints.sh b/test/failpoint/failpoints.sh index 719a06f009..4aef64ac59 100755 --- a/test/failpoint/failpoints.sh +++ b/test/failpoint/failpoints.sh @@ -8,6 +8,7 @@ failpoints=( "vitess.io/vitess/go/vt/vtgate/showTablets=return(2)" "vitess.io/vitess/go/vt/vtgate/engine/InsertFailPoint=return(1)" +"vitess.io/vitess/go/vt/vtgate/testPanic=return(1)" ) # Create an empty string