KV routing tests wait for both replicas to be scraped: a replica not yet heard from is passed over, and the test was racing that
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
9e46ee83e4
commit
f1a3199e55
1 file changed
+22
-1
@@ -9,6 +9,7 @@ import (
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus/testutil"
|
||||
|
||||
@@ -95,7 +96,27 @@ func kvRouter(t *testing.T, tier1 bool) (*Router, *kvFakeVLLM, *kvFakeVLLM) {
|
||||
other.RoutingProfile = "chat"
|
||||
cfg.Models = []catalog.Model{m, other}
|
||||
cfg.Router.Prefix.Enabled = tier1
|
||||
return newTestRouter(t, cfg), a, b
|
||||
rt := newTestRouter(t, cfg)
|
||||
// Both scraped before anything is sent: a replica not yet heard from is
|
||||
// passed over while another has been, which is admission's rule and not
|
||||
// what these tests are about.
|
||||
deadline := time.Now().Add(3 * time.Second)
|
||||
for {
|
||||
fresh := 0
|
||||
for _, sn := range rt.reg.Snapshots("m") {
|
||||
if !sn.Stale {
|
||||
fresh++
|
||||
}
|
||||
}
|
||||
if fresh == 2 {
|
||||
break
|
||||
}
|
||||
if time.Now().After(deadline) {
|
||||
t.Fatal("the replicas were never scraped")
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
return rt, a, b
|
||||
}
|
||||
|
||||
// longPrompt is long enough for several blocks of sixteen.
|
||||
|
||||
Reference in new issue
Block a user