expect `Enable()` inTerm:'off' does not trigger failpoint code, but it's not as expect
Open
Nobody has claimed this yet.
bug
- Dominant language
- Go
- Stars
- 895
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Bug Report
- CODE(Transfromed)
func GetValue() int {
if _, _err_ := failpoint.Eval(_curpkg_("failpoint-name")); _err_ == nil {
fmt.Println("enable failpoint")
}
return 1
}
- TEST CODE
func TestGetValue(t *testing.T) {
var err error
fmt.Println("############case01###############")
err = failpoint.Enable("test/failpoint-name", "return(true)->off")
if err != nil {
t.Fatal("enable failpoint failed:", err)
}
GetValue()
fmt.Println("############case02###############")
err = failpoint.Enable("test/failpoint-name", "off")
if err != nil {
t.Fatal("enable failpoint failed:", err)
}
GetValue()
fmt.Println("############case03###############")
err = failpoint.Enable("test/failpoint-name", "return(2)")
if err != 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)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the README's definition of the off action and trace how failpoint.Enable handles return(true)->off, off, and return(2) in the transformed Go code. Run go test -v -run TestGetValue using the reported cases and compare whether the observed output matches the documented semantics. Done means the three cases produce the behavior described by the README.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100