gateway tests: the burst tests allow the moment a first word takes to reach magpie (TestCodexBackendBurstTellsNoSpeed red on macOS CI at 58f45d05: Millis 612, TTFT 13)
de5455b8's tests asserted that the time from the first word to the end was at least the upstream's 600 ms wait. The fake upstream starts that wait once it has sent the first word, and magpie stamps TTFT when the word arrives, so the span is the gap less the delivery time: 599 ms on a busy macOS runner. TestBurstTellsNoSpeed had the same `span < gap` check; both now want 90% of the gap. The speed assertions they guard (a burst tells no speed, a steady stream keeps it) are unchanged. Run in docker golang:1.26.8 as uid 1000: go vet -tags nogui ./internal/gateway; go test -race -count=15 -cpu 1,4 -run 'TestCodexBackendBurstTellsNoSpeed|TestBurstTellsNoSpeed' pass. Not reproduced locally with an injected delay; the CI log above is the red.
This commit is contained in:
1 parent
4ed6df801c
commit
8d6e9bad49
1 file changed
+7
-2
@@ -354,7 +354,10 @@ func TestBurstTellsNoSpeed(t *testing.T) {
|
||||
}
|
||||
u := lastUsage(t)
|
||||
span := u.Millis - u.TTFT
|
||||
if u.TTFT <= 0 || span < gap.Milliseconds() {
|
||||
// the upstream's wait starts when it sent the first word,
|
||||
// which magpie reads a moment later: the span is the gap
|
||||
// less that moment (599 ms of 600 on a busy macOS runner)
|
||||
if u.TTFT <= 0 || span < gap.Milliseconds()*9/10 {
|
||||
t.Fatalf("usage ttft %d, ms %d; want the end %v after the first word", u.TTFT, u.Millis, gap)
|
||||
}
|
||||
r := lastRoute(s)
|
||||
@@ -386,7 +389,9 @@ func TestCodexBackendBurstTellsNoSpeed(t *testing.T) {
|
||||
t.Fatalf("%d %s", code, body)
|
||||
}
|
||||
u := lastUsage(t)
|
||||
if u.Millis-u.TTFT < 600 || u.Output != 1000 {
|
||||
// the end after the wait, less the moment the first word took to
|
||||
// reach magpie (599 ms of 600 on macOS CI at 58f45d05)
|
||||
if u.Millis-u.TTFT < 540 || u.Output != 1000 {
|
||||
t.Fatalf("usage %+v", u)
|
||||
}
|
||||
if n, w := u.Decode(); n != 0 || w != 0 {
|
||||
|
||||
Reference in new issue
Block a user