Documentation
¶
Overview ¶
Package datatest is the conformance suite of the data package: the checks every data.Store must pass against a live database, whatever the engine, the returning commands' form, and the variant. An engine sub-module's integration tier runs it over the baseline and its own variant; a consumer with an Engine of its own runs it over that. It is a package of its own because another module's tests cannot import a _test.go helper.
The package exports:
- Run, which runs the suite against a live database
- FileRows and DirectoryRows, which script blobfs's rows for the query library's scripted driver, sqltest, so a consumer's unit tests of code over the store read the rows its statements scan
The suite imports no engine and no driver, and every statement it runs outside the store is standard SQL. Where an outcome belongs to a variation point or a returning command, it compares the store under test with a second store over the baseline on the same database, rows and refusals in text. It creates two tables of its own, standing in for a consumer's foreign keys into blobfs_file and blobfs_directory, and an index on blobfs_file (directory_id, created_at), which it drops again. See "datatest: the conformance suite" in docs/features.md.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirectoryRows ¶ added in v0.3.0
DirectoryRows scripts, for sqltest's driver, a read of blobfs_directory rows, one row per directory, in the columns the store's statements scan; a nil ParentID is the root's NULL. With no directory it is a read that finds no row.
func FileRows ¶ added in v0.3.0
FileRows scripts, for sqltest's driver, a read of blobfs_file rows, one row per file, in the columns the store's statements scan; a nil Size or ETag is NULL. With no file it is a read that finds no row. It is for a consumer's scripted tests of code over the store, beside the suite.
func Run ¶
Run runs the suite as subtests of t, over a store built from catalog and db's dialect with engine, and over a second store on the baseline to compare against. A nil engine is the baseline itself. catalog carries data.Patterns() beside the query library's patterns or an engine's overlay of them. db is a throwaway database with blobfs's migration set applied, and Run is called once per database; a dialect that renders RETURNING covers the single-statement form, and one that does not the fallback.
The groups run in the order docs/features.md lists: Verify, Directories, Paths, Files, Writes, Deletes, Protocols, Holds, Moves, Listing, Keyset, Branches, and Sweeps. Protocols runs before any group marks a branch, and sweeps the branches it marks itself. Branches runs after the others because the branches it marks stay in the tree; Sweeps runs last because its first pass removes them.
Types ¶
This section is empty.