Browse Source

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.
pull/7608/head
M. J. Fromberger 2 years ago
committed by GitHub
parent
commit
5eae2e62c0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions
  1. +6
    -5
      privval/signer_client_test.go

+ 6
- 5
privval/signer_client_test.go View File

@ -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)
})
}
}


Loading…
Cancel
Save