Skip to content

Commit 142bde5

Browse files
committed
Patch the return time with MaxInt64 in robustness test
Reference: - #19579 Signed-off-by: Chun-Hung Tseng <[email protected]>
1 parent 53b88df commit 142bde5

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

tests/robustness/model/history.go

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package model
1616

1717
import (
1818
"fmt"
19+
"math"
1920
"strings"
2021
"time"
2122

@@ -488,36 +489,17 @@ func (h History) Len() int {
488489

489490
func (h History) Operations() []porcupine.Operation {
490491
operations := make([]porcupine.Operation, 0, len(h.operations))
491-
maxTime := h.lastObservedTime()
492492
for _, op := range h.operations {
493493
// Failed requests don't have a known return time.
494494
if op.Return == -1 {
495-
// Simulate Infinity by using last observed time.
496-
op.Return = maxTime + time.Second.Nanoseconds()
495+
// Simulate infinity for failed requests
496+
op.Return = math.MaxInt64
497497
}
498498
operations = append(operations, op)
499499
}
500500
return operations
501501
}
502502

503-
func (h History) lastObservedTime() int64 {
504-
var maxTime int64
505-
for _, op := range h.operations {
506-
if op.Return == -1 {
507-
// Collect call time from failed operations
508-
if op.Call > maxTime {
509-
maxTime = op.Call
510-
}
511-
} else {
512-
// Collect return time from successful operations
513-
if op.Return > maxTime {
514-
maxTime = op.Return
515-
}
516-
}
517-
}
518-
return maxTime
519-
}
520-
521503
func (h History) MaxRevision() int64 {
522504
var maxRevision int64
523505
for _, op := range h.operations {

0 commit comments

Comments
 (0)