gocloud.devgocloud.dev/secrets/drivertest Index | Files

package drivertest

import "gocloud.dev/secrets/drivertest"

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

Index

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

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.

Source Files

drivertest.go

Version
v0.23.0
Published
May 15, 2021
Platform
js/wasm
Imports
7 packages
Last checked
4 hours ago

Tools for package owners.