Documentation
¶
Overview ¶
Package contracttest provides a shared test suite that validates the blobcache.Store contract. Backend authors (diskblob, future s3blob, gcsblob, etc.) call RunStoreContractTests with a factory that returns a fresh, empty Store rooted at a temp location; the suite then exercises the contractually required behavior — round-trip, ETag determinism, namespace isolation, concurrent put on the same key, list-after-delete, and traversal rejection.
The suite is intentionally factory-based so backends with non-trivial setup (S3 buckets, GCS prefixes, redis prefixes) can plug in their own teardown hook via the test's t.Cleanup.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunStoreContractTests ¶
func RunStoreContractTests(t *testing.T, factory StoreFactory)
RunStoreContractTests exercises every contractual guarantee of blobcache.Store. Call this from a backend's _test.go:
func TestStoreContract(t *testing.T) {
contracttest.RunStoreContractTests(t, func(t *testing.T) blobcache.Store {
return fsstore.New(t.TempDir())
})
}
Each contract assertion lives in its own helper to keep cyclomatic complexity low and make individual assertions easy to skip / extend in downstream backends. Add new assertions by appending another helper here and a corresponding t.Run line below.