Documentation
¶
Overview ¶
Package mock offers a mock for the secrets Component allowing testing of secrets resolution.
Index ¶
- type Mock
- func (m *Mock) Configure(_ secrets.ConfigParams)
- func (m *Mock) IsValueFromSecret(value string) bool
- func (m *Mock) Refresh() bool
- func (m *Mock) RefreshNow() (string, error)
- func (m *Mock) RemoveOrigin(_ string)
- func (m *Mock) Resolve(data []byte, origin string, _ string, _ string, notify bool) ([]byte, error)
- func (m *Mock) SetIsValueFromSecretHook(hook func(string) bool)
- func (m *Mock) SetRefreshHook(hook func() bool)
- func (m *Mock) SetRefreshNowHook(hook func() (string, error))
- func (m *Mock) SetSecretOriginatedValues(values []string)
- func (m *Mock) SetSecrets(secrets map[string]string)
- func (m *Mock) SubscribeToChanges(callback secrets.SecretChangeCallback)
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 (*Mock) Configure ¶
func (m *Mock) Configure(_ secrets.ConfigParams)
Configure is a noop for the mock
func (*Mock) IsValueFromSecret ¶ added in v0.78.0
IsValueFromSecret returns true if the given value was ever resolved from a secret handle
func (*Mock) RefreshNow ¶ added in v0.78.0
RefreshNow performs an immediate blocking secret refresh
func (*Mock) Resolve ¶
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
SetIsValueFromSecretHook sets a hook function that will be called when IsValueFromSecret is invoked
func (*Mock) SetRefreshHook ¶ added in v0.74.0
SetRefreshHook sets a hook function that will be called when Refresh is invoked
func (*Mock) SetRefreshNowHook ¶ added in v0.78.0
SetRefreshNowHook sets a hook function that will be called when RefreshNow is invoked
func (*Mock) SetSecretOriginatedValues ¶ added in v0.78.0
SetSecretOriginatedValues sets a predefined set of values that IsValueFromSecret will recognize
func (*Mock) SetSecrets ¶
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