Skip to content

Commit 064142d

Browse files
committed
Fix triggers test.
1 parent 3edc858 commit 064142d

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

hedge/triggers_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ func TestLatencyTrigger_ShouldSpawnHedge(t *testing.T) {
1717
percentile string
1818
elapsed time.Duration
1919
attempts int
20+
maxHedges int
2021
want bool
2122
wantWait time.Duration
2223
}{
@@ -25,6 +26,7 @@ func TestLatencyTrigger_ShouldSpawnHedge(t *testing.T) {
2526
percentile: "p50",
2627
elapsed: 5 * time.Millisecond,
2728
attempts: 1,
29+
maxHedges: 1,
2830
want: false,
2931
wantWait: 5 * time.Millisecond, // 10 - 5
3032
},
@@ -33,6 +35,7 @@ func TestLatencyTrigger_ShouldSpawnHedge(t *testing.T) {
3335
percentile: "p50",
3436
elapsed: 11 * time.Millisecond,
3537
attempts: 1,
38+
maxHedges: 1,
3639
want: true,
3740
wantWait: 0,
3841
},
@@ -41,6 +44,7 @@ func TestLatencyTrigger_ShouldSpawnHedge(t *testing.T) {
4144
percentile: "p99",
4245
elapsed: 90 * time.Millisecond,
4346
attempts: 1,
47+
maxHedges: 1,
4448
want: false,
4549
wantWait: 10 * time.Millisecond,
4650
},
@@ -49,6 +53,7 @@ func TestLatencyTrigger_ShouldSpawnHedge(t *testing.T) {
4953
percentile: "p99",
5054
elapsed: 101 * time.Millisecond,
5155
attempts: 1,
56+
maxHedges: 1,
5257
want: true,
5358
wantWait: 0,
5459
},
@@ -57,6 +62,7 @@ func TestLatencyTrigger_ShouldSpawnHedge(t *testing.T) {
5762
percentile: "p50",
5863
elapsed: 20 * time.Millisecond,
5964
attempts: 2,
65+
maxHedges: 1,
6066
want: false,
6167
wantWait: 0,
6268
},
@@ -65,6 +71,7 @@ func TestLatencyTrigger_ShouldSpawnHedge(t *testing.T) {
6571
percentile: "pXX",
6672
elapsed: 1000 * time.Millisecond,
6773
attempts: 1,
74+
maxHedges: 1,
6875
want: false,
6976
wantWait: 0,
7077
},
@@ -73,6 +80,7 @@ func TestLatencyTrigger_ShouldSpawnHedge(t *testing.T) {
7380
percentile: "p50",
7481
elapsed: 100 * time.Millisecond,
7582
attempts: 1,
83+
maxHedges: 1,
7684
want: false, // Threshold is 0, so <= 0 check returns false?
7785
// Logic: threshold <= 0 returns false.
7886
wantWait: 0,
@@ -85,6 +93,7 @@ func TestLatencyTrigger_ShouldSpawnHedge(t *testing.T) {
8593
state := HedgeState{
8694
Elapsed: tt.elapsed,
8795
AttemptsLaunched: tt.attempts,
96+
MaxHedges: tt.maxHedges,
8897
Snapshot: snap,
8998
}
9099
if tt.name == "Zero Stats" {

0 commit comments

Comments
 (0)