Skip to content

Commit

Permalink
chore(e2e): stress remove global testTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Apr 6, 2022
1 parent 39ec48b commit ed961e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
3 changes: 1 addition & 2 deletions tests/stress/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ import (
)

var (
testTimeout = time.Minute * 3
logger = log.NewFromGlobal(log.AddContext("pkg", "tests/stress"))
logger = log.NewFromGlobal(log.AddContext("pkg", "tests/stress"))
)

// compareChainHeads calls getChainHead for each node in the array
Expand Down
20 changes: 10 additions & 10 deletions tests/stress/stress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,23 +326,23 @@ func TestSync_Bench(t *testing.T) {
start := time.Now()
var end time.Time

const retryWait = time.Second
const syncWaitTimeout = 3 * time.Minute
syncWaitCtx, syncWaitCancel := context.WithTimeout(ctx, syncWaitTimeout)
for {
if time.Since(start) >= testTimeout {
t.Fatal("did not sync")
}

getChainHeadCtx, getChainHeadCancel := context.WithTimeout(ctx, time.Second)
getChainHeadCtx, getChainHeadCancel := context.WithTimeout(syncWaitCtx, time.Second)
head, err := rpc.GetChainHead(getChainHeadCtx, bob.GetRPCPort())
getChainHeadCancel()

if err != nil {
continue
}

if head.Number >= last {
if err == nil && head.Number >= last {
end = time.Now()
syncWaitCancel()
break
}

retryWaitCtx, retryWaitCancel := context.WithTimeout(syncWaitCtx, retryWait)
<-retryWaitCtx.Done()
retryWaitCancel()
}

maxTime := time.Second * 85
Expand Down

0 comments on commit ed961e4

Please sign in to comment.