forked from quic-go/quic-go
properly stop the testserver at the end of a test in integration tests
This commit is contained in:
@@ -25,8 +25,9 @@ var (
|
|||||||
PRData = GeneratePRData(dataLen)
|
PRData = GeneratePRData(dataLen)
|
||||||
PRDataLong = GeneratePRData(dataLenLong)
|
PRDataLong = GeneratePRData(dataLenLong)
|
||||||
|
|
||||||
server *h2quic.Server
|
server *h2quic.Server
|
||||||
port string
|
stoppedServing chan struct{}
|
||||||
|
port string
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -95,14 +96,18 @@ func StartQuicServer(versions []protocol.VersionNumber) {
|
|||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
port = strconv.Itoa(conn.LocalAddr().(*net.UDPAddr).Port)
|
port = strconv.Itoa(conn.LocalAddr().(*net.UDPAddr).Port)
|
||||||
|
|
||||||
|
stoppedServing = make(chan struct{})
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer GinkgoRecover()
|
defer GinkgoRecover()
|
||||||
server.Serve(conn)
|
server.Serve(conn)
|
||||||
|
close(stoppedServing)
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
func StopQuicServer() {
|
func StopQuicServer() {
|
||||||
Expect(server.Close()).NotTo(HaveOccurred())
|
Expect(server.Close()).NotTo(HaveOccurred())
|
||||||
|
Eventually(stoppedServing).Should(BeClosed())
|
||||||
}
|
}
|
||||||
|
|
||||||
func Port() string {
|
func Port() string {
|
||||||
|
|||||||
Reference in New Issue
Block a user