a06f331eb8
CI / benchmark (push) Has been skipped
install-script / posix-syntax (push) Successful in 6m1s
CI / build-onnx (push) Failing after 6m43s
init-smoke / dry-run (push) Failing after 15m57s
security / govulncheck (push) Has been cancelled
security / trivy-fs (push) Has been cancelled
CI / test (1.26, ubuntu-latest) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
CI / test (1.26, macos-latest) (push) Has been cancelled
CI / build-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
install-script / powershell-syntax (push) Has been cancelled
install-script / install (macos-14) (push) Has been cancelled
install-script / install (ubuntu-latest) (push) Has been cancelled
29 lines
844 B
Go
29 lines
844 B
Go
package mcp
|
|
|
|
import "testing"
|
|
|
|
// TestResetConfirmedRefs asserts the lazy-enrichment ledger is emptied
|
|
// when the graph is rebuilt so it stays scoped to one analysis epoch
|
|
// instead of growing for the daemon's lifetime.
|
|
func TestResetConfirmedRefs(t *testing.T) {
|
|
s := &Server{}
|
|
for _, id := range []string{"a.go::A", "b.go::B", "c.go::C"} {
|
|
s.refsConfirmed.Store(id, struct{}{})
|
|
}
|
|
|
|
s.resetConfirmedRefs()
|
|
|
|
n := 0
|
|
s.refsConfirmed.Range(func(_, _ any) bool { n++; return true })
|
|
if n != 0 {
|
|
t.Fatalf("refsConfirmed has %d entries after reset, want 0", n)
|
|
}
|
|
|
|
// Reusable after clearing: a later store is cleared by a second reset.
|
|
s.refsConfirmed.Store("d.go::D", struct{}{})
|
|
s.resetConfirmedRefs()
|
|
if _, ok := s.refsConfirmed.Load("d.go::D"); ok {
|
|
t.Fatal("entry stored after reset should be cleared by a second reset")
|
|
}
|
|
}
|