Collect costs for dispatched model attempts
This commit is contained in:
@@ -41,6 +41,25 @@ func TestGroupTerminalAccounting(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGroupCostCoverageIsIndependentOfTerminalCoverage(t *testing.T) {
|
||||
var group Group
|
||||
if got := group.Snapshot().CostUSD; got != (domain.ObservedCost{Known: true, Complete: true}) {
|
||||
t.Fatalf("empty=%+v", got)
|
||||
}
|
||||
group.Observe(domain.ExecutionEvent{Kind: domain.ExecutionStarted, RunID: "pending"})
|
||||
if got := group.Snapshot().CostUSD; got != (domain.ObservedCost{}) {
|
||||
t.Fatalf("pending=%+v", got)
|
||||
}
|
||||
charge := domain.ObservedCost{Value: .25, Known: true, Complete: true, Source: domain.CostSourceProvider}
|
||||
terminal := domain.ExecutionEvent{Kind: domain.ExecutionFinished, RunID: "done", CostUSD: charge}
|
||||
group.Observe(terminal)
|
||||
group.Observe(terminal)
|
||||
got := group.Snapshot()
|
||||
if got.TerminalCoverageComplete || got.CostUSD != charge {
|
||||
t.Fatalf("snapshot=%+v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGroupConcurrentSnapshots(t *testing.T) {
|
||||
var group Group
|
||||
var wg sync.WaitGroup
|
||||
|
||||
Reference in New Issue
Block a user