Repository navigation
test: run the lock store contract against the documented stores - #49
Merged
kamilmysliwiec merged 1 commit intoOct 29, 2026
Merged
Conversation
The docs give the DrizzleLockStore and RedisLockStore recipes for applications to copy and check with lockStoreContract(), but the suite only ran the contract against InMemoryLockStore. Run it with concurrent: true against both recipes, on the PGlite, PostgreSQL and Redis servers the integration spec already opens, over a pool of connections where the server takes them. The cases live in the integration spec so that its FLUSHALL between tests can't empty a shared Redis server under a contract case. The expiry cases wait in real time, which adds about a minute to the e2e run.
sadatsajid
force-pushed
the
test/contract-on-documented-stores
branch
from
October 29, 2026 08:13
c166f73 to
7034a0b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
lib/What is the current behavior?
The docs give the
DrizzleLockStoreandRedisLockStorerecipes for applications to copy, and tell them to check a store withlockStoreContract(). The repo runs the contract only againstInMemoryLockStore. The recipes go through the stores integration spec (several instances, jobs, elections), but not through the contract's cases: expiry measured on the server's clock, tokens across releases and expiries, keys kept apart, and the concurrency races.Issue Number: N/A
What is the new behavior?
The stores integration spec also runs
lockStoreContract(..., { concurrent: true })against each recipe, on the servers it already opens:DrizzleLockStoreon PGliteDrizzleLockStoreon PostgreSQL, over the backend'spg.PoolRedisLockStoreon Redis, over 8 connections, so the concurrency cases race for realA server that isn't available skips its cases with the reason, as the instances do.
StoreBackendgets an optionalcontractStore(); the in-memory backend has none, sincein-memory-store.spec.tsalready runs the contract on aManualLockClock.All 16 cases pass on each of the three: the full e2e suite is 335 passed, with PostgreSQL 18.6 and Redis 8.10 local, on Node 25.
Does this PR introduce a breaking change?
Other information
The cases sit in the integration spec rather than a file of their own: files run in parallel, and on CI's shared Redis service the
FLUSHALLbetween the integration tests could empty the store under a contract case. In one file they run after the instances.The expiry cases wait in real time, so the e2e run goes from about 20s to about 75s.