From 969a1343eb75dc7682d8112c8bc308da1baec716 Mon Sep 17 00:00:00 2001 From: zelig Date: Sat, 3 Feb 2024 22:45:23 +0100 Subject: [PATCH] test(file): fix timeouts --- pkg/file/joiner/joiner_test.go | 5 +++-- pkg/file/redundancy/getter/getter_test.go | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/file/joiner/joiner_test.go b/pkg/file/joiner/joiner_test.go index c76406495a5..15d46bf220b 100644 --- a/pkg/file/joiner/joiner_test.go +++ b/pkg/file/joiner/joiner_test.go @@ -1243,11 +1243,12 @@ func TestJoinerRedundancyMultilevel(t *testing.T) { canReadRange := func(t *testing.T, s getter.Strategy, fallback bool, levels int, canRead bool) { ctx := context.Background() strategyTimeout := 100 * time.Millisecond + decodingTimeout := 600 * time.Millisecond if racedetection.IsOn() { - strategyTimeout *= 2 + decodingTimeout *= 2 } ctx = getter.SetConfigInContext(ctx, s, fallback, (2 * strategyTimeout).String(), strategyTimeout.String()) - ctx, cancel := context.WithTimeout(ctx, time.Duration(levels*3+2)*strategyTimeout) + ctx, cancel := context.WithTimeout(ctx, time.Duration(levels)*(3*strategyTimeout+decodingTimeout)) defer cancel() j, _, err := joiner.New(ctx, store, store, addr) if err != nil { diff --git a/pkg/file/redundancy/getter/getter_test.go b/pkg/file/redundancy/getter/getter_test.go index d24164ea8ed..b18caa55c12 100644 --- a/pkg/file/redundancy/getter/getter_test.go +++ b/pkg/file/redundancy/getter/getter_test.go @@ -95,6 +95,9 @@ func TestGetterFallback(t *testing.T) { func testDecodingRACE(t *testing.T, bufSize, shardCnt, erasureCnt int) { t.Helper() strategyTimeout := 100 * time.Millisecond + if racedetection.On { + strategyTimeout *= 2 + } store := inmem.New() buf := make([][]byte, bufSize) addrs := initData(t, buf, shardCnt, store) @@ -128,7 +131,7 @@ func testDecodingRACE(t *testing.T, bufSize, shardCnt, erasureCnt int) { err := context.DeadlineExceeded wait := strategyTimeout * 2 if racedetection.On { - wait = strategyTimeout * 3 + wait *= 2 } select { case err = <-q: