mock

package module
v0.78.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package mock offers a mock for the secrets Component allowing testing of secrets resolution.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mock

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

Mock is a mock of the secret Component useful for testing

func New

func New(_ testing.TB) *Mock

New returns a MockResolver

func (*Mock) Configure

func (m *Mock) Configure(_ secrets.ConfigParams)

Configure is a noop for the mock

func (*Mock) IsValueFromSecret added in v0.78.0

func (m *Mock) IsValueFromSecret(value string) bool

IsValueFromSecret returns true if the given value was ever resolved from a secret handle

func (*Mock) Refresh

func (m *Mock) Refresh() bool

Refresh schedules an asynchronous secret refresh

func (*Mock) RefreshNow added in v0.78.0

func (m *Mock) RefreshNow() (string, error)

RefreshNow performs an immediate blocking secret refresh

func (*Mock) RemoveOrigin added in v0.75.0

func (m *Mock) RemoveOrigin(_ string)

RemoveOrigin

func (*Mock) Resolve

func (m *Mock) Resolve(data []byte, origin string, _ string, _ string, notify bool) ([]byte, error)

Resolve resolves the secrets in the given yaml data by replacing secrets handles by their corresponding secret value from the data receive by `SetSecrets` method

func (*Mock) SetIsValueFromSecretHook added in v0.78.0

func (m *Mock) SetIsValueFromSecretHook(hook func(string) bool)

SetIsValueFromSecretHook sets a hook function that will be called when IsValueFromSecret is invoked

func (*Mock) SetRefreshHook added in v0.74.0

func (m *Mock) SetRefreshHook(hook func() bool)

SetRefreshHook sets a hook function that will be called when Refresh is invoked

func (*Mock) SetRefreshNowHook added in v0.78.0

func (m *Mock) SetRefreshNowHook(hook func() (string, error))

SetRefreshNowHook sets a hook function that will be called when RefreshNow is invoked

func (*Mock) SetSecretOriginatedValues added in v0.78.0

func (m *Mock) SetSecretOriginatedValues(values []string)

SetSecretOriginatedValues sets a predefined set of values that IsValueFromSecret will recognize

func (*Mock) SetSecrets

func (m *Mock) SetSecrets(secrets map[string]string)

SetSecrets set the map of handle to secrets value for the mock

func (*Mock) SubscribeToChanges

func (m *Mock) SubscribeToChanges(callback secrets.SecretChangeCallback)

SubscribeToChanges registers a callback to be invoked whenever secrets are resolved or refreshed

Jump to

Keyboard shortcuts

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