Skip to content

Commit

Permalink
fix flaky session test
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Feb 23, 2021
1 parent 0f6c8ad commit 3c9a48c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,8 @@ func TestSession_PartialReadWindowUpdate(t *testing.T) {
}

var (
exp = uint32(flood / 2)
expWithoutWindowIncrease = uint32(flood / 2)
expWithWindowIncrease = uint32(flood *3/ 2)
sendWindow uint32
)

Expand All @@ -1230,11 +1231,11 @@ func TestSession_PartialReadWindowUpdate(t *testing.T) {
for i := 1; i < 15; i++ {
time.Sleep(time.Duration(i*i) * time.Millisecond)
sendWindow = atomic.LoadUint32(&wr.sendWindow)
if sendWindow == exp {
if sendWindow == expWithoutWindowIncrease || sendWindow == expWithWindowIncrease {
return
}
}
t.Errorf("sendWindow: exp=%d, got=%d", exp, sendWindow)
t.Errorf("sendWindow: exp=%d or %d, got=%d", expWithoutWindowIncrease, expWithWindowIncrease, sendWindow)
}

func TestSession_sendMsg_Timeout(t *testing.T) {
Expand Down

0 comments on commit 3c9a48c

Please sign in to comment.