mirror of
https://github.com/mjl-/mox.git
synced 2025-07-10 06:34:40 +03:00
fix race in test setup/teardown
not easily triggered, but it happened just now on a build server.
This commit is contained in:
@ -45,14 +45,14 @@ func setup(t *testing.T) (*store.Account, func()) {
|
||||
tcheck(t, err, "open account")
|
||||
err = acc.SetPassword("testtest")
|
||||
tcheck(t, err, "set password")
|
||||
switchDone := store.Switchboard()
|
||||
switchStop := store.Switchboard()
|
||||
mox.Shutdown, mox.ShutdownCancel = context.WithCancel(ctxbg)
|
||||
return acc, func() {
|
||||
acc.Close()
|
||||
mox.ShutdownCancel()
|
||||
mox.Shutdown, mox.ShutdownCancel = context.WithCancel(ctxbg)
|
||||
Shutdown()
|
||||
close(switchDone)
|
||||
switchStop()
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user