-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃 [Question]: app.Test
may hang infinitely with handler calling runtime.Goexit
#1996
Comments
This comment was marked as outdated.
This comment was marked as outdated.
And I think it's important to check the parameters at the controller level and make sure that the mock covers these test cases, rather than making the mock function call t.FailNow. Changing app.Test will introduce unnecessary complexity. |
this is more a developer experience problem. Mocks may call if a test disable |
After reading source of go func() {
channel <- app.server.ServeConn(conn)
}() go func() {
var returned bool
defer func() {
if !returned {
channel <- fmt.Errorf("runtime.Goexit() called in handler")
}
}()
r := app.server.ServeConn(conn)
returned = true
channel <- r
}() |
t.FailNow()
app.Test
may hang infinitely with handler calling runtime.Goexit
I get your mean, the long hang-up is indeed unexpected behavior. |
Question Description
I'm using
github.com/stretchr/testify/mock
to create a mock, and this library may callt.FailNow()
if caller try to do a unexpected method call.But
(*testing.T).FailNow()
will only callruntime.Goexit
but notpanic
.Therefore, the handler can't panic if the test fail. and I can only get a timeout error instead of panic error.
and, if
app.Test
is called without timeout, this test will hang infinitely .I want to know is there a way to handle this problem?
Code Snippet (optional)
Checklist:
The text was updated successfully, but these errors were encountered: