Skip to main content

Module test_helpers

Module test_helpers 

Source

Structs§

CrossPrincipalTestDevice
InterceptedStorage
A CloudSyncObjectStorage that forwards every call to inner, giving interceptor its chance first.
TestCustody
In-memory MasterKeyCustody for tests, with a switch to force persist to fail. The switch models a device whose keyring is momentarily unwritable, so a test can drive a key adoption into its failure path and then clear the switch to prove the retry converges. Stores the serialized form (like the real Keyring preset), so stored_key reflects exactly what a caller wrote.
TestDevice
TestDeviceSigningAuthority
TestDropboxAccessAdministrator
Grants a Dropbox shared-folder membership to whichever peer account asks — the provider-side step a cross-principal admission needs before the joining device can write to the store’s namespace.
TestError
TestStore

Enums§

ProtocolRead
Which protocol read an interceptor hook is running ahead of.
ProviderObjectExistsInterception
TestPullError
Why a test pull did not produce a result. Keeps the three steps a test pull runs — opening the store, authorizing the writer, running the cycle — apart, so a test asserting on one of them cannot pass on another.

Traits§

StorageInterceptor
Test-side observation of a CloudSyncObjectStorage call.

Functions§

copy_payload_files
Copy the file-backed payloads one store directory holds into another.
create_synced_schema
The synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly. Create the synthetic test schema on a connection. Run as the host migration step for open_test_db (see test_migrations).
open_test_db
The synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly. Open a Database over a fresh in-memory connection with the synthetic test schema and the test_synced_tables synced set.
open_test_db_schema
The synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly. Like open_test_db but with an explicit synced set and migration ladder, for tests that exercise a different schema (gate tests).
open_test_db_with_blob
The synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly. Open a test Database over the synthetic schema with note_photos declared blob-bearing per decl.
open_test_db_with_hlc
The synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly. Open a test Database over the synthetic schema with a caller-supplied register clock (so a test can control the wall clock), plus an extra seed step run after the host schema is created to plant host rows before Database::open reads its floor.
open_test_db_with_tombstone_grace
The synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly.
open_test_db_with_user_and_host_blobs
The synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly. Open a test Database with both note_photos (per photo_decl) and note_covers (per cover_decl) declared blob-bearing — the schema for the per-provenance transition tests.
photo_decl
The synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly. The host-provided, eagerly-cached photo blob declaration most blob tests use.
pubkey_hex
Hex-encoded ed25519 public key, as membership entries and the wrapped-key store identify a member.
read_test_db
The synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly. Open a read-test Database whose note_photos child carries a blob in namespace, so read_blob’s locality dispatch can resolve a blob in that namespace up to its gated notes root. 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 the BlobRef), so this fixes them. Pair with Database::plant_blob_row_for_test.
read_test_db_with_download_limit
The synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly. Like read_test_db but with a chosen max_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 synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly. The notes schema with a remote-root parent, carrying decl on note_photos.
staged_snapshot_image
store_database
The synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly. 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
The synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly.
temp_store_dir
A temp dir plus a StoreDir rooted at it. The returned TempDir must be held for the directory to outlive the test.
test_cloud_home
An InMemoryCloudHome bound to a fixed Google Drive provider, for the tests that need a cloud home but do not care which provider it claims to be.
test_cloud_home_with_binding
test_migrations
The synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly. The synthetic test schema as a single-migration ladder, so a test db opens at schema_version() == 1. The host-schema ladder for every open_test_db* helper.
test_store_dir
The synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly. Construct an isolated Store directory for a test composition root.
test_synced_tables
The synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly. 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 its shared boolean), 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_photos carries no blob here; blob tests declare one with test_synced_tables_with_blob.
test_synced_tables_remote_root_with_blob
The synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly. test_synced_tables_with_blob with an ungated notes root: 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
The synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly. test_synced_tables with note_photos declared blob-bearing per decl, for tests exercising the blob push/pull/backfill paths. The blob id defaults to the note_photos primary key; note_photos.cloud_path holds a readable key for plain-scheme tests, and note_photos.blob_id is 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
The synthetic store’s schema and Database constructors, which the database layer owns and its own tests open directly. test_synced_tables with TWO blob-bearing children of the gated notes root: note_photos per photo_decl (a release file, user-provided) and note_covers per cover_decl (a host-provided asset). Both inherit the notes gate, 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.
user_keypair_from_seed
Ed25519 identity derived from exact test-owned seed bytes.

Type Aliases§

TestStoreParts