forked from quic-go/quic-go
fix flaky flow controller test
This commit is contained in:
@@ -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() {
|
It("increases the window size if read so fast that the window would be consumed in less than 4 RTTs", func() {
|
||||||
bytesRead := controller.bytesRead
|
bytesRead := controller.bytesRead
|
||||||
rtt := 20 * time.Millisecond
|
rtt := 200 * time.Millisecond
|
||||||
setRtt(rtt)
|
setRtt(rtt)
|
||||||
// consume more than 2/3 of the window...
|
// consume more than 2/3 of the window...
|
||||||
dataRead := receiveWindowSize*2/3 + 1
|
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
|
// 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))
|
Expect(protocol.WindowUpdateThreshold).To(BeNumerically(">", 1/3))
|
||||||
bytesRead := controller.bytesRead
|
bytesRead := controller.bytesRead
|
||||||
rtt := 20 * time.Millisecond
|
rtt := 200 * time.Millisecond
|
||||||
setRtt(rtt)
|
setRtt(rtt)
|
||||||
// consume more than 2/3 of the window...
|
// consume more than 2/3 of the window...
|
||||||
dataRead := receiveWindowSize*1/3 + 1
|
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() {
|
It("doesn't increase the window size if read too slowly", func() {
|
||||||
bytesRead := controller.bytesRead
|
bytesRead := controller.bytesRead
|
||||||
rtt := 20 * time.Millisecond
|
rtt := 200 * time.Millisecond
|
||||||
setRtt(rtt)
|
setRtt(rtt)
|
||||||
// consume less than 2/3 of the window...
|
// consume less than 2/3 of the window...
|
||||||
dataRead := receiveWindowSize*2/3 - 1
|
dataRead := receiveWindowSize*2/3 - 1
|
||||||
@@ -204,7 +204,7 @@ var _ = Describe("Base Flow controller", func() {
|
|||||||
controller.epochStartOffset = controller.bytesRead
|
controller.epochStartOffset = controller.bytesRead
|
||||||
controller.AddBytesRead(controller.receiveWindowSize/2 + 1)
|
controller.AddBytesRead(controller.receiveWindowSize/2 + 1)
|
||||||
}
|
}
|
||||||
setRtt(20 * time.Millisecond)
|
setRtt(200 * time.Millisecond)
|
||||||
resetEpoch()
|
resetEpoch()
|
||||||
controller.maybeAdjustWindowSize()
|
controller.maybeAdjustWindowSize()
|
||||||
Expect(controller.receiveWindowSize).To(Equal(2 * oldWindowSize)) // 2000
|
Expect(controller.receiveWindowSize).To(Equal(2 * oldWindowSize)) // 2000
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ var _ = Describe("Connection Flow controller", func() {
|
|||||||
It("autotunes the window", func() {
|
It("autotunes the window", func() {
|
||||||
oldOffset := controller.bytesRead
|
oldOffset := controller.bytesRead
|
||||||
oldWindowSize := controller.receiveWindowSize
|
oldWindowSize := controller.receiveWindowSize
|
||||||
rtt := 20 * time.Millisecond
|
rtt := 200 * time.Millisecond
|
||||||
setRtt(rtt)
|
setRtt(rtt)
|
||||||
controller.epochStartTime = time.Now().Add(-time.Millisecond)
|
controller.epochStartTime = time.Now().Add(-time.Millisecond)
|
||||||
controller.epochStartOffset = oldOffset
|
controller.epochStartOffset = oldOffset
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ var _ = Describe("Stream Flow controller", func() {
|
|||||||
It("tells the connection flow controller when the window was autotuned", func() {
|
It("tells the connection flow controller when the window was autotuned", func() {
|
||||||
oldOffset := controller.bytesRead
|
oldOffset := controller.bytesRead
|
||||||
controller.contributesToConnection = true
|
controller.contributesToConnection = true
|
||||||
setRtt(20 * time.Millisecond)
|
setRtt(200 * time.Millisecond)
|
||||||
controller.epochStartOffset = oldOffset
|
controller.epochStartOffset = oldOffset
|
||||||
controller.epochStartTime = time.Now().Add(-time.Millisecond)
|
controller.epochStartTime = time.Now().Add(-time.Millisecond)
|
||||||
controller.AddBytesRead(55)
|
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() {
|
It("doesn't tell the connection flow controller if it doesn't contribute", func() {
|
||||||
oldOffset := controller.bytesRead
|
oldOffset := controller.bytesRead
|
||||||
controller.contributesToConnection = false
|
controller.contributesToConnection = false
|
||||||
setRtt(20 * time.Millisecond)
|
setRtt(200 * time.Millisecond)
|
||||||
controller.epochStartOffset = oldOffset
|
controller.epochStartOffset = oldOffset
|
||||||
controller.epochStartTime = time.Now().Add(-time.Millisecond)
|
controller.epochStartTime = time.Now().Add(-time.Millisecond)
|
||||||
controller.AddBytesRead(55)
|
controller.AddBytesRead(55)
|
||||||
|
|||||||
Reference in New Issue
Block a user