mirror of
https://github.com/lightninglabs/aperture.git
synced 2026-01-31 07:04:26 +01:00
hashmail: isolate server per test
Register the Aperture instance created in setupAperture with t.Cleanup so that every test stops its own server even if it fails. This keeps the global HashMail stream map clean and prevents TestHashMailServerLargeMessage from inheriting leftover streams from TestHashMailServerReturnStream. This prevents cascading test failures, when a failure in one test is replicated as many failures in many tests, complicating debugging from logs.
This commit is contained in:
@@ -188,6 +188,10 @@ func setupAperture(t *testing.T) {
|
||||
errChan := make(chan error)
|
||||
shutdown := make(chan struct{})
|
||||
require.NoError(t, aperture.Start(errChan, shutdown))
|
||||
t.Cleanup(func() {
|
||||
close(shutdown)
|
||||
require.NoError(t, aperture.Stop())
|
||||
})
|
||||
|
||||
// Any error while starting?
|
||||
select {
|
||||
|
||||
Reference in New Issue
Block a user