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

package drivertest

import "gocloud.dev/secrets/drivertest"

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


Package Files


func RunConformanceTests Uses

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

RunConformanceTests runs conformance tests for driver implementations of secret management.

type AsTest Uses

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 Uses

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.

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

type HarnessMaker Uses

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.

Package drivertest imports 7 packages (graph). Updated 2019-08-02. Refresh now. Tools for package owners.