Skip to content

Commit

Permalink
test(file): fix timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
zelig committed Feb 4, 2024
1 parent ec66cc4 commit 969a134
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pkg/file/joiner/joiner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion pkg/file/redundancy/getter/getter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 969a134

Please sign in to comment.