storetest

package
v0.2.2-dev.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package storetest gives tests a migrated panel database quickly. store.Open on a new file used to run every migration, which took about 0.3 s, and 4.3 s under -race: in a package whose tests each open a store (internal/panel/fleet opens one per test, four hundred of them) the migrations were most of the race job's time. Open now builds a new file from an embedded snapshot of the finished schema (store/schema_snapshot.sql), about 55 ms without -race (not measured under it), and goose then finds every migration applied. Path still builds the database once per test binary, keeps the result in memory, and gives each test its own copy of it, which store.Open then opens in about 75 ms under -race (measured before the snapshot).

The copy is the same database a fresh store.Open would make: the template is a store.Open on an empty file, checkpointed and closed, and opening the copy runs store.Open's start-up work again (it finds every migration applied).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Path

func Path(t testing.TB) string

Path writes a copy of the migrated template database into a new temporary directory of t and returns the file's path, for store.Open. Each call is a new database.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL