Skip to content

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

@Amaya-aisi

Description

@Amaya-aisi

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)

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