Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Normalize ¶
Normalize decodes a JSON response body and blanks the parts that are expected to vary from run to run, so the remaining shape can be diffed against a golden file.
It always blanks:
- any object key named "request_id" (recursively, any nesting level)
- any string value that looks like an RFC3339 timestamp (recursively, any nesting level, regardless of key name)
When blankTopLevelExecTime is true, it additionally blanks the top-level "execution_time_ms" key (used only for the /sql/execute golden, whose value is wall-clock and therefore nondeterministic). It never blanks execution_time_ms nested inside other structures (e.g. /sql/queries record objects), because those values are deterministic aggregations and regressions in them must fail the golden comparison.
The result is re-encoded with object keys sorted (Go's encoding/json sorts map[string]interface{} keys on Marshal) and 2-space indentation, for a stable, readable diff.
func WriteFixtureLogs ¶
WriteFixtureLogs writes two MySQL slow-log files into dir with timestamps relative to now, so /sql/queries' default now-15d window always includes them. Deterministic except for the sliding timestamps.
Types ¶
type Fixture ¶
type Fixture struct {
Path string // for tests that open their own StorageManager
Store *storage.Storage // read-only handle, closed via t.Cleanup
}
Fixture is a seeded, read-only DuckDB plus its file path.
func BuildFixtureDB ¶
BuildFixtureDB generates the fixture logs, parses them into a temp DuckDB, and returns a read-only handle. Deterministic (bar sliding timestamps).