brontide/noise_test: defer wait group decrement
If any of the checks in the goroutine fail, the test will deadlock since the waitgroup is never released.
This commit is contained in:
parent
e3728da478
commit
12ec999252
@ -269,6 +269,8 @@ func TestWriteMessageChunking(t *testing.T) {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
bytesWritten, err := localConn.Write(largeMessage)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to write message: %v", err)
|
||||
@ -280,7 +282,6 @@ func TestWriteMessageChunking(t *testing.T) {
|
||||
t.Fatalf("bytes not fully written!")
|
||||
}
|
||||
|
||||
wg.Done()
|
||||
}()
|
||||
|
||||
// Attempt to read the entirety of the message generated above.
|
||||
|
Loading…
Reference in New Issue
Block a user