secrettest

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package secrettest provides test helpers for code that depends on the v2/secret package. Use MockProvider to supply known secret values in unit tests without touching the environment or the filesystem.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockProvider

type MockProvider struct {
	// contains filtered or unexported fields
}

MockProvider is a Provider implementation for use in tests. It returns values from a map supplied at construction time.

func NewMockProvider

func NewMockProvider(secrets map[string]string) *MockProvider

NewMockProvider returns a MockProvider pre-loaded with the given secrets. Keys that are absent from the map cause Get to return an error wrapping secret.ErrNotFound.

func (*MockProvider) Get

func (m *MockProvider) Get(_ context.Context, key string) (secret.Secret, error)

Get returns the value for key from the pre-loaded map. If the key is not present, Get returns an error wrapping secret.ErrNotFound.

Jump to

Keyboard shortcuts

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