forked from quic-go/quic-go
fix timeout integration tests on Windows (#4758)
The Go timer resolution on Windows leaves a lot to be desired. By bumping the timeout duration the test will take longer, but at least it won't be flaky.
This commit is contained in:
@@ -170,6 +170,10 @@ func TestIdleTimeout(t *testing.T) {
|
|||||||
|
|
||||||
func TestKeepAlive(t *testing.T) {
|
func TestKeepAlive(t *testing.T) {
|
||||||
idleTimeout := scaleDuration(150 * time.Millisecond)
|
idleTimeout := scaleDuration(150 * time.Millisecond)
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
// increase the duration, since timers on Windows are not very precise
|
||||||
|
idleTimeout = max(idleTimeout, 600*time.Millisecond)
|
||||||
|
}
|
||||||
|
|
||||||
server, err := quic.ListenAddr(
|
server, err := quic.ListenAddr(
|
||||||
"localhost:0",
|
"localhost:0",
|
||||||
@@ -233,6 +237,10 @@ func TestKeepAlive(t *testing.T) {
|
|||||||
|
|
||||||
func TestTimeoutAfterInactivity(t *testing.T) {
|
func TestTimeoutAfterInactivity(t *testing.T) {
|
||||||
idleTimeout := scaleDuration(150 * time.Millisecond)
|
idleTimeout := scaleDuration(150 * time.Millisecond)
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
// increase the duration, since timers on Windows are not very precise
|
||||||
|
idleTimeout = max(idleTimeout, 600*time.Millisecond)
|
||||||
|
}
|
||||||
|
|
||||||
server, err := quic.ListenAddr(
|
server, err := quic.ListenAddr(
|
||||||
"localhost:0",
|
"localhost:0",
|
||||||
@@ -300,10 +308,11 @@ func TestTimeoutAfterInactivity(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTimeoutAfterSendingPacket(t *testing.T) {
|
func TestTimeoutAfterSendingPacket(t *testing.T) {
|
||||||
if runtime.GOOS == "windows" {
|
|
||||||
t.Skip("This test is flaky on Windows due to low timer precision.")
|
|
||||||
}
|
|
||||||
idleTimeout := scaleDuration(150 * time.Millisecond)
|
idleTimeout := scaleDuration(150 * time.Millisecond)
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
// increase the duration, since timers on Windows are not very precise
|
||||||
|
idleTimeout = max(idleTimeout, 600*time.Millisecond)
|
||||||
|
}
|
||||||
|
|
||||||
server, err := quic.ListenAddr(
|
server, err := quic.ListenAddr(
|
||||||
"localhost:0",
|
"localhost:0",
|
||||||
|
|||||||
Reference in New Issue
Block a user