Skip to content

Commit

Permalink
Prevent a test from writing to a closed v2 server
Browse files Browse the repository at this point in the history
  • Loading branch information
David Robertson committed Oct 19, 2023
1 parent 7172fda commit c94670e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests-integration/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ func TestConnectionTimeoutNotReset(t *testing.T) {
}
req.SetTimeoutMSecs(1000) // 1s
// inject 4 events 500ms apart - if we reset the timeout each time then we will return late
done := make(chan struct{})
go func() {
time.Sleep(10 * time.Millisecond)
ticker := time.NewTicker(500 * time.Millisecond)
Expand All @@ -277,6 +278,7 @@ func TestConnectionTimeoutNotReset(t *testing.T) {
})
i++
}
done <- struct{}{}
}()
startTime := time.Now()
res = v3.mustDoV3RequestWithPos(t, aliceToken, res.Pos, req)
Expand All @@ -286,6 +288,8 @@ func TestConnectionTimeoutNotReset(t *testing.T) {
}
m.MatchResponse(t, res, m.MatchList("a", m.MatchV3Count(2)), m.MatchNoV3Ops())

// Wait for all the responses before closing the v2 server.
<-done
}

// Test that the txn_id is echoed back
Expand Down

0 comments on commit c94670e

Please sign in to comment.