Expand description
The synthetic store every test database opens over: its synced schema, its
migration ladder, and the Database constructors that combine the two.
Domain-free on purpose — three tables exercising the engine’s generic mechanics rather than any host’s real shape.
Functions§
- create_
synced_ schema - Create the synthetic test schema on a connection. Run as the host migration
step for
open_test_db(seetest_migrations). - open_
test_ db - Open a
Databaseover a fresh in-memory connection with the synthetic test schema and thetest_synced_tablessynced set. - open_
test_ db_ schema - Like
open_test_dbbut with an explicit synced set and migration ladder, for tests that exercise a different schema (gate tests). - open_
test_ db_ with_ blob - Open a test
Databaseover the synthetic schema withnote_photosdeclared blob-bearing perdecl. - open_
test_ db_ with_ hlc - Open a test
Databaseover the synthetic schema with a caller-supplied register clock (so a test can control the wall clock), plus an extraseedstep run after the host schema is created to plant host rows beforeDatabase::openreads its floor. - open_
test_ db_ with_ tombstone_ grace - open_
test_ db_ with_ user_ and_ host_ blobs - Open a test
Databasewith bothnote_photos(perphoto_decl) andnote_covers(percover_decl) declared blob-bearing — the schema for the per-provenance transition tests. - photo_
decl - The host-provided, eagerly-cached photo blob declaration most blob tests use.
- read_
test_ db - Open a read-test
Databasewhosenote_photoschild carries a blob innamespace, soread_blob’s locality dispatch can resolve a blob in that namespace up to its gatednotesroot. The decl’s namespace MUST match the blobs the test reads (the read path resolves the carrying table from the blob’s namespace); its provenance/fill don’t matter to that resolution (the read reads the row → root → gate, and takes provenance off theBlobRef), so this fixes them. Pair withDatabase::plant_blob_row_for_test. - read_
test_ db_ with_ download_ limit - Like
read_test_dbbut with a chosenmax_concurrent_downloads, so a pin test can drive the download loop concurrently. Uploads run one at a time (not exercised here). - remote_
root_ db - The notes schema with a remote-root parent, carrying
declonnote_photos. - store_
database - The Store view of a test database. Every sync test builds one; naming it here keeps the three test modules that used to declare it from drifting apart.
- store_
dir_ for_ test_ database - test_
migrations - The synthetic test schema as a single-migration ladder, so a test db opens at
schema_version() == 1. The host-schema ladder for everyopen_test_db*helper. - test_
store_ dir - Construct an isolated Store directory for a test composition root.
- test_
synced_ tables - The synthetic, domain-free schema the sync tests run against. Three synced
tables exercising the engine’s generic mechanics: a gated root (
notes, gated by itssharedboolean), a child with a foreign key (note_tags, which inherits the gate and exercises FK-violation retry), and a child that CAN carry a blob (note_photos, also FK-to-notes, so it inherits the gate).note_photoscarries no blob here; blob tests declare one withtest_synced_tables_with_blob. - test_
synced_ tables_ remote_ root_ with_ blob test_synced_tables_with_blobwith an ungatednotesroot: the rows are remote from the start rather than waiting on a gate, which is what a snapshot test needs to have something to publish before any gate is opened.- test_
synced_ tables_ with_ blob test_synced_tableswithnote_photosdeclared blob-bearing perdecl, for tests exercising the blob push/pull/backfill paths. The blob id defaults to thenote_photosprimary key;note_photos.cloud_pathholds a readable key for plain-scheme tests, andnote_photos.blob_idis there for a decl that names a blob id apart from the PK — the shape a row repointed at a new blob needs, since the row keeps its primary key.- test_
synced_ tables_ with_ user_ and_ host_ blobs test_synced_tableswith TWO blob-bearing children of the gatednotesroot:note_photosperphoto_decl(a release file, user-provided) andnote_coverspercover_decl(a host-provided asset). Both inherit thenotesgate, so a make_remote of a note carries both — the user-provided file through the durable outbox and the host-provided cover through the inline push — exercising the per-provenance split in one subtree.