dbtest

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 13 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

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultTimeout is the default timeout for running the test harness.
	DefaultTimeout = 5 * time.Second
	// DefaultRelPath is the default relative path to the test data.
	DefaultRelPath = "../dbtest/testdata"
)

Functions

func ChainFixture

func ChainFixture(t *testing.T, org string, asVersion int) []*x509.Certificate

ChainFixture reads a chain fixture from the suite's shared test data: the AS certificate of the given version under the CP CA certificate — the one loader every trust-database episode reads fixtures through.

func Run

func Run(t *testing.T, db TestableDB, cfg Config)

Run should be used to test any implementation of the trustdb.DB interface. An implementation interface should at least have one test method that calls this test-suite.

Types

type Config

type Config struct {
	Timeout time.Duration
	RelPath string
}

Config holds the configuration for the trust database testing harness.

func (*Config) InitDefaults

func (cfg *Config) InitDefaults()

InitDefaults initializes the default values for the config.

type TestableDB

type TestableDB interface {
	trustdb.DB
	// Prepare should reset the internal state so that the db is empty and is ready to be tested.
	Prepare(*testing.T, context.Context)
}

TestableDB extends the trust db interface with methods that are needed for testing.

Jump to

Keyboard shortcuts

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