-
Notifications
You must be signed in to change notification settings - Fork 208
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intermittent panic when go test with -coverpkg #288
Comments
On Fri, Aug 12, 2022 at 04:27:09AM -0700, wwn0594 wrote:
Miniredis intermittent panic when I run `go test` with `-coverpkg`
```
- GOOS=linux GOARCH=amd64 go test ./... -coverprofile=./cover.out -coverpkg=./...
```
Curious. Thanks for reporting!, I'll have a look soon (unless someone beats me
to it :)
|
That's https://github.com/alicebob/miniredis/blob/master/server/server.go#L122
I don't get the error locally, and looking at the code, might it be that you start a redis server in a Go routine, and it's not ready starting yet when you use it? Would it otherwise be possible to make a standalone test case? |
@alicebob Thanks for investigation! I didn't start redis on go routine, instead I put it on a init() func, and start on a fixed port.
That's very strange, I met the panic only if set |
On Mon, Aug 15, 2022 at 12:35:43AM -0700, wwn0594 wrote:
@alicebob Thanks for investigation! I didn't start redis on go routine, instead I put it on a init() func, and start on a fixed port.
Ok, that sounds allright.
```
if addr != "" {
return addr, "", 0, tls, nil
}
log.Info().Msg("No redis set on env, start mini redis.")
mr := miniredis.NewMiniRedis()
mr.StartAddr(":15678")
Could you check the error response here?
…
addr = mr.Addr()
return addr, "", 0, tls, nil
```
|
Since you give a fixed port there can't be multiple (mini)redises running at the same time, but |
@alicebob aha, got the errMsg
It seems |
It works! Thanks a lot |
Miniredis intermittent panic when I run
go test
with-coverpkg
The text was updated successfully, but these errors were encountered: