make sure RunHandshake has returned before closing, improve MITM tests

This commit is contained in:
Marten Seemann
2022-08-13 16:12:46 +03:00
parent f2fa98c0dd
commit 7fde609eef
4 changed files with 90 additions and 100 deletions

View File

@@ -17,7 +17,9 @@ import (
mrand "math/rand"
"net"
"os"
"runtime/pprof"
"strconv"
"strings"
"sync"
"testing"
"time"
@@ -294,7 +296,14 @@ var _ = BeforeEach(func() {
}
})
func areHandshakesRunning() bool {
var b bytes.Buffer
pprof.Lookup("goroutine").WriteTo(&b, 1)
return strings.Contains(b.String(), "RunHandshake")
}
var _ = AfterEach(func() {
Expect(areHandshakesRunning()).To(BeFalse())
if debugLog() {
logFile, err := os.Create(logFileName)
Expect(err).ToNot(HaveOccurred())