chore: import upstream snapshot with attribution
govulncheck / govulncheck (push) Has been cancelled
Lint / golangci-lint (push) Has been cancelled
Run Tests / Unit Tests (push) Has been cancelled
Run Tests / Etcd Integration Tests (push) Has been cancelled
Harness (E2E) / Harnesses (mock LLM) (push) Has been cancelled
Harness (E2E) / Provider harnesses (live LLM conformance) (push) Has been cancelled
govulncheck / govulncheck (push) Has been cancelled
Lint / golangci-lint (push) Has been cancelled
Run Tests / Unit Tests (push) Has been cancelled
Run Tests / Etcd Integration Tests (push) Has been cancelled
Harness (E2E) / Harnesses (mock LLM) (push) Has been cancelled
Harness (E2E) / Provider harnesses (live LLM conformance) (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package store
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestScopeIsolatesTables(t *testing.T) {
|
||||
base := NewMemoryStore()
|
||||
|
||||
a := Scope(base, "agent", "one")
|
||||
b := Scope(base, "agent", "two")
|
||||
|
||||
if err := a.Write(&Record{Key: "history", Value: []byte("A")}); err != nil {
|
||||
t.Fatalf("write a: %v", err)
|
||||
}
|
||||
if err := b.Write(&Record{Key: "history", Value: []byte("B")}); err != nil {
|
||||
t.Fatalf("write b: %v", err)
|
||||
}
|
||||
|
||||
// Same key, different scopes — the values must not collide.
|
||||
recs, err := a.Read("history")
|
||||
if err != nil || len(recs) != 1 || string(recs[0].Value) != "A" {
|
||||
t.Fatalf("scope a read = %v %v", recs, err)
|
||||
}
|
||||
recs, err = b.Read("history")
|
||||
if err != nil || len(recs) != 1 || string(recs[0].Value) != "B" {
|
||||
t.Fatalf("scope b read = %v %v", recs, err)
|
||||
}
|
||||
|
||||
// List is confined to the scope.
|
||||
keys, err := a.List()
|
||||
if err != nil || len(keys) != 1 {
|
||||
t.Fatalf("scope a list = %v %v, want 1 key", keys, err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user