From 5a169b3c9ae7a2ceee87a674726a0b3c0442443c Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Wed, 6 May 2020 11:15:12 +0700 Subject: [PATCH 1/2] fix racy session unit test --- session_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/session_test.go b/session_test.go index 677cf580a..8d15d3d0f 100644 --- a/session_test.go +++ b/session_test.go @@ -1055,13 +1055,16 @@ var _ = Describe("Session", func() { It("sends ACK only packets", func() { sph := mockackhandler.NewMockSentPacketHandler(mockCtrl) + sph.EXPECT().TimeUntilSend().AnyTimes() sph.EXPECT().GetLossDetectionTimeout().AnyTimes() sph.EXPECT().SendMode().Return(ackhandler.SendAck) sph.EXPECT().ShouldSendNumPackets().Return(1000) - packer.EXPECT().MaybePackAckPacket(false) - runSession() + done := make(chan struct{}) + packer.EXPECT().MaybePackAckPacket(false).Do(func(bool) { close(done) }) sess.sentPacketHandler = sph - Expect(sess.sendPackets()).To(Succeed()) + runSession() + sess.scheduleSending() + Eventually(done).Should(BeClosed()) }) It("adds a BLOCKED frame when it is connection-level flow control blocked", func() { From 9c3b947814012be9cbc8a8f277cb5b09393e091a Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Tue, 5 May 2020 19:23:00 +0700 Subject: [PATCH 2/2] run all unit tests with race detector --- .travis/script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis/script.sh b/.travis/script.sh index 7004b42b6..fbe54699b 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -13,10 +13,10 @@ fi if [ ${TESTMODE} == "unit" ]; then ginkgo -r -v -cover -randomizeAllSpecs -randomizeSuites -trace -skipPackage integrationtests,benchmark - # run internal and http3 tests with the Go race detector + # run unit tests with the Go race detector # The Go race detector only works on amd64. if [ ${TRAVIS_GOARCH} == 'amd64' ]; then - ginkgo -r -v -race -randomizeAllSpecs -randomizeSuites -trace internal http3 + ginkgo -race -r -v -randomizeAllSpecs -randomizeSuites -trace -skipPackage integrationtests,benchmark fi fi