Skip to content

expect Enable() inTerm:'off' does not trigger failpoint code, but it's not as expect #86

Description

@Amaya-aisi

Bug Report

  • CODE(Transfromed)
funcGetValue() int {
if_, _err_:=failpoint.Eval(_curpkg_("failpoint-name")); _err_==nil {
fmt.Println("enable failpoint")
}
return1
}
  • TEST CODE
funcTestGetValue(t*testing.T) {
varerrerrorfmt.Println("############case01###############")
err=failpoint.Enable("test/failpoint-name", "return(true)->off")
iferr!=nil {
t.Fatal("enable failpoint failed:", err)
}
GetValue()
fmt.Println("############case02###############")
err=failpoint.Enable("test/failpoint-name", "off")
iferr!=nil {
t.Fatal("enable failpoint failed:", err)
}
GetValue()
fmt.Println("############case03###############")
err=failpoint.Enable("test/failpoint-name", "return(2)")
iferr!=nil {
t.Fatal("enable failpoint failed:", err)
}
GetValue()
}
  • EXPECT:
    According to README, "off: Take no action (does not trigger failpoint code)", used to stop triggering of the failpoint. So my expectation is that case02 and case03 should not print "enable failpoint".
  • ACTUAL:
    It seems no working. I'm not sure if I'm misunderstanding this argument.
go test -v -run TestGetValue
=== RUN TestGetValue
############case01###############enable failpoint
############case02###############enable failpoint
############case03###############enable failpoint
--- PASS: TestGetValue (0.00s)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions