drivertest

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package drivertest provides a conformance test for implementations of the secrets driver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunConformanceTests

func RunConformanceTests(t *testing.T, newHarness HarnessMaker, asTests []AsTest)

RunConformanceTests runs conformance tests for driver implementations of secret management.

Types

type AsTest added in v0.10.0

type AsTest interface {
	// Name returns a descriptive name for the test.
	Name() string
	// ErrorCheck is called to allow verification of Keeper.ErrorAs.
	ErrorCheck(k *secrets.Keeper, err error) error
}

AsTest represents a test of As functionality. The conformance test: 1. Tries to decrypt malformed message, and calls ErrorCheck with the error.

type Harness

type Harness interface {
	// MakeDriver returns a pair of driver.Keeper, each backed by a different key.
	MakeDriver(ctx context.Context) (driver.Keeper, driver.Keeper, error)

	// Close is called when the test is complete.
	Close()
}

Harness descibes the functionality test harnesses must provide to run conformance tests.

type HarnessMaker

type HarnessMaker func(ctx context.Context, t *testing.T) (Harness, error)

HarnessMaker describes functions that construct a harness for running tests. It is called exactly once per test.

Jump to

Keyboard shortcuts

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