From 20816bb866beebe6c3ae8af971244366417d5e74 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Fri, 22 Dec 2017 13:08:31 +0700 Subject: [PATCH] fix flaky flow controller test --- internal/flowcontrol/base_flow_controller_test.go | 8 ++++---- internal/flowcontrol/connection_flow_controller_test.go | 2 +- internal/flowcontrol/stream_flow_controller_test.go | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/flowcontrol/base_flow_controller_test.go b/internal/flowcontrol/base_flow_controller_test.go index 0668f627b..9128cdaaa 100644 --- a/internal/flowcontrol/base_flow_controller_test.go +++ b/internal/flowcontrol/base_flow_controller_test.go @@ -141,7 +141,7 @@ var _ = Describe("Base Flow controller", func() { It("increases the window size if read so fast that the window would be consumed in less than 4 RTTs", func() { bytesRead := controller.bytesRead - rtt := 20 * time.Millisecond + rtt := 200 * time.Millisecond setRtt(rtt) // consume more than 2/3 of the window... dataRead := receiveWindowSize*2/3 + 1 @@ -162,7 +162,7 @@ var _ = Describe("Base Flow controller", func() { // this test only makes sense if a window update is triggered before half of the window has been consumed Expect(protocol.WindowUpdateThreshold).To(BeNumerically(">", 1/3)) bytesRead := controller.bytesRead - rtt := 20 * time.Millisecond + rtt := 200 * time.Millisecond setRtt(rtt) // consume more than 2/3 of the window... dataRead := receiveWindowSize*1/3 + 1 @@ -181,7 +181,7 @@ var _ = Describe("Base Flow controller", func() { It("doesn't increase the window size if read too slowly", func() { bytesRead := controller.bytesRead - rtt := 20 * time.Millisecond + rtt := 200 * time.Millisecond setRtt(rtt) // consume less than 2/3 of the window... dataRead := receiveWindowSize*2/3 - 1 @@ -204,7 +204,7 @@ var _ = Describe("Base Flow controller", func() { controller.epochStartOffset = controller.bytesRead controller.AddBytesRead(controller.receiveWindowSize/2 + 1) } - setRtt(20 * time.Millisecond) + setRtt(200 * time.Millisecond) resetEpoch() controller.maybeAdjustWindowSize() Expect(controller.receiveWindowSize).To(Equal(2 * oldWindowSize)) // 2000 diff --git a/internal/flowcontrol/connection_flow_controller_test.go b/internal/flowcontrol/connection_flow_controller_test.go index d3941a81b..d2b6dfa24 100644 --- a/internal/flowcontrol/connection_flow_controller_test.go +++ b/internal/flowcontrol/connection_flow_controller_test.go @@ -63,7 +63,7 @@ var _ = Describe("Connection Flow controller", func() { It("autotunes the window", func() { oldOffset := controller.bytesRead oldWindowSize := controller.receiveWindowSize - rtt := 20 * time.Millisecond + rtt := 200 * time.Millisecond setRtt(rtt) controller.epochStartTime = time.Now().Add(-time.Millisecond) controller.epochStartOffset = oldOffset diff --git a/internal/flowcontrol/stream_flow_controller_test.go b/internal/flowcontrol/stream_flow_controller_test.go index 191d47337..46c6b0008 100644 --- a/internal/flowcontrol/stream_flow_controller_test.go +++ b/internal/flowcontrol/stream_flow_controller_test.go @@ -184,7 +184,7 @@ var _ = Describe("Stream Flow controller", func() { It("tells the connection flow controller when the window was autotuned", func() { oldOffset := controller.bytesRead controller.contributesToConnection = true - setRtt(20 * time.Millisecond) + setRtt(200 * time.Millisecond) controller.epochStartOffset = oldOffset controller.epochStartTime = time.Now().Add(-time.Millisecond) controller.AddBytesRead(55) @@ -197,7 +197,7 @@ var _ = Describe("Stream Flow controller", func() { It("doesn't tell the connection flow controller if it doesn't contribute", func() { oldOffset := controller.bytesRead controller.contributesToConnection = false - setRtt(20 * time.Millisecond) + setRtt(200 * time.Millisecond) controller.epochStartOffset = oldOffset controller.epochStartTime = time.Now().Add(-time.Millisecond) controller.AddBytesRead(55)