mirror of
https://github.com/tendermint/tendermint.git
synced 2026-04-17 06:01:04 +00:00
privval: synchronize leak check with shutdown (#7629)
The interaction between defers and t.Cleanup can be delicate. For this case, which regularly flakes in CI, be explicit: Defer the closes and waits before making any attempt to leaktest.
This commit is contained in:
@@ -73,14 +73,15 @@ func TestSignerClose(t *testing.T) {
|
||||
|
||||
for _, tc := range getSignerTestCases(bctx, t, logger) {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Cleanup(leaktest.Check(t))
|
||||
|
||||
defer tc.closer()
|
||||
defer leaktest.Check(t)
|
||||
defer func() {
|
||||
tc.closer()
|
||||
tc.signerClient.endpoint.Wait()
|
||||
tc.signerServer.Wait()
|
||||
}()
|
||||
|
||||
assert.NoError(t, tc.signerClient.Close())
|
||||
assert.NoError(t, tc.signerServer.Stop())
|
||||
t.Cleanup(tc.signerClient.endpoint.Wait)
|
||||
t.Cleanup(tc.signerServer.Wait)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user