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:
Conner Fromknecht 2019-04-22 16:04:37 -07:00
parent e3728da478
commit 12ec999252
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7

@ -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.