v1 plan: helpers_test.go as a given file, fake upstream records /v1/models, no /tmp rule; note task 05 findings

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 04:56:22 -07:00
co-authored by Claude Fable 5.1
parent 1cc645a85b
commit 7bc6761120
4 changed files with 55 additions and 1 deletions
@@ -0,0 +1,39 @@
package proxy_test
import (
"sync"
"git.wntrmute.dev/kyle/crossbar/internal/health"
)
// fakeHealth is a hand-set health table that also records MarkDown calls. It lived in the v0
// proxy_test.go; the v1 given test replaces that file, so recorder_test.go (which still exercises
// the nil-lease path through proxy.New) needs it here.
type fakeHealth struct {
mu sync.Mutex
st map[string]health.Status
marked []string
}
func (f *fakeHealth) Get(name string) (health.Status, bool) {
f.mu.Lock()
defer f.mu.Unlock()
s, ok := f.st[name]
return s, ok
}
func (f *fakeHealth) MarkDown(name, reason string) {
f.mu.Lock()
defer f.mu.Unlock()
f.marked = append(f.marked, name)
s := f.st[name]
s.Healthy = false
s.LastErr = reason
f.st[name] = s
}
func (f *fakeHealth) markedHosts() []string {
f.mu.Lock()
defer f.mu.Unlock()
return append([]string{}, f.marked...)
}