inmemory

package
v1.0.0-alpha.18 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package inmemory provides an in-memory implementation of a secret store suitable for unit testing.

Index

Constants

View Source
const (
	// MockStoreType is a bucket where Connect and Close calls are recorded.
	MockStoreType = "mock-store"

	// SecretType is a bucket for the actual secrets.
	// This avoids a circular import, this const should really be defined in cnab-go...
	SecretType = "secret"

	// ConnectCount records the number of times Connect has been called.
	ConnectCount = "connect-count"

	// CloseCount records the number of times Close has been called.
	CloseCount = "close-count"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	Secrets map[string]map[string]string
}

Store implements an in-memory secrets store for testing.

func NewStore

func NewStore() *Store

func (*Store) AddSecret

func (s *Store) AddSecret(key string, value string)

func (*Store) Close

func (s *Store) Close() error

func (*Store) Connect

func (s *Store) Connect() error

func (*Store) GetCloseCount

func (s *Store) GetCloseCount() (int, error)

GetCloseCount is for tests to safely read the Close call count without accidentally triggering it by using Read.

func (*Store) GetConnectCount

func (s *Store) GetConnectCount() (int, error)

GetConnectCount is for tests to safely read the Connect call count without accidentally triggering it by using Read.

func (*Store) Resolve

func (s *Store) Resolve(keyName string, keyValue string) (string, error)

Jump to

Keyboard shortcuts

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