Documentation ¶
Index ¶
- type KeptnSLIProviderMock
- func (mock *KeptnSLIProviderMock) EvaluateQuery(ctx context.Context, metric metricsapi.KeptnMetric, ...) (string, []byte, error)
- func (mock *KeptnSLIProviderMock) EvaluateQueryCalls() []struct{ ... }
- func (mock *KeptnSLIProviderMock) EvaluateQueryForStep(ctx context.Context, metric metricsapi.KeptnMetric, ...) ([]string, []byte, error)
- func (mock *KeptnSLIProviderMock) EvaluateQueryForStepCalls() []struct{ ... }
- func (mock *KeptnSLIProviderMock) FetchAnalysisValue(ctx context.Context, query string, spec metricsapi.Analysis, ...) (string, error)
- func (mock *KeptnSLIProviderMock) FetchAnalysisValueCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeptnSLIProviderMock ¶
type KeptnSLIProviderMock struct { // EvaluateQueryFunc mocks the EvaluateQuery method. EvaluateQueryFunc func(ctx context.Context, metric metricsapi.KeptnMetric, provider metricsapi.KeptnMetricsProvider) (string, []byte, error) // EvaluateQueryForStepFunc mocks the EvaluateQueryForStep method. EvaluateQueryForStepFunc func(ctx context.Context, metric metricsapi.KeptnMetric, provider metricsapi.KeptnMetricsProvider) ([]string, []byte, error) // FetchAnalysisValueFunc mocks the FetchAnalysisValue method. FetchAnalysisValueFunc func(ctx context.Context, query string, spec metricsapi.Analysis, provider *metricsapi.KeptnMetricsProvider) (string, error) // contains filtered or unexported fields }
KeptnSLIProviderMock is a mock implementation of providers.KeptnSLIProvider.
func TestSomethingThatUsesKeptnSLIProvider(t *testing.T) { // make and configure a mocked providers.KeptnSLIProvider mockedKeptnSLIProvider := &KeptnSLIProviderMock{ EvaluateQueryFunc: func(ctx context.Context, metric metricsapi.KeptnMetric, provider metricsapi.KeptnMetricsProvider) (string, []byte, error) { panic("mock out the EvaluateQuery method") }, EvaluateQueryForStepFunc: func(ctx context.Context, metric metricsapi.KeptnMetric, provider metricsapi.KeptnMetricsProvider) ([]string, []byte, error) { panic("mock out the EvaluateQueryForStep method") }, FetchAnalysisValueFunc: func(ctx context.Context, query string, spec metricsapi.Analysis, provider *metricsapi.KeptnMetricsProvider) (string, error) { panic("mock out the FetchAnalysisValue method") }, } // use mockedKeptnSLIProvider in code that requires providers.KeptnSLIProvider // and then make assertions. }
func (*KeptnSLIProviderMock) EvaluateQuery ¶
func (mock *KeptnSLIProviderMock) EvaluateQuery(ctx context.Context, metric metricsapi.KeptnMetric, provider metricsapi.KeptnMetricsProvider) (string, []byte, error)
EvaluateQuery calls EvaluateQueryFunc.
func (*KeptnSLIProviderMock) EvaluateQueryCalls ¶
func (mock *KeptnSLIProviderMock) EvaluateQueryCalls() []struct { Ctx context.Context Metric metricsapi.KeptnMetric Provider metricsapi.KeptnMetricsProvider }
EvaluateQueryCalls gets all the calls that were made to EvaluateQuery. Check the length with:
len(mockedKeptnSLIProvider.EvaluateQueryCalls())
func (*KeptnSLIProviderMock) EvaluateQueryForStep ¶
func (mock *KeptnSLIProviderMock) EvaluateQueryForStep(ctx context.Context, metric metricsapi.KeptnMetric, provider metricsapi.KeptnMetricsProvider) ([]string, []byte, error)
EvaluateQueryForStep calls EvaluateQueryForStepFunc.
func (*KeptnSLIProviderMock) EvaluateQueryForStepCalls ¶
func (mock *KeptnSLIProviderMock) EvaluateQueryForStepCalls() []struct { Ctx context.Context Metric metricsapi.KeptnMetric Provider metricsapi.KeptnMetricsProvider }
EvaluateQueryForStepCalls gets all the calls that were made to EvaluateQueryForStep. Check the length with:
len(mockedKeptnSLIProvider.EvaluateQueryForStepCalls())
func (*KeptnSLIProviderMock) FetchAnalysisValue ¶
func (mock *KeptnSLIProviderMock) FetchAnalysisValue(ctx context.Context, query string, spec metricsapi.Analysis, provider *metricsapi.KeptnMetricsProvider) (string, error)
FetchAnalysisValue calls FetchAnalysisValueFunc.
func (*KeptnSLIProviderMock) FetchAnalysisValueCalls ¶
func (mock *KeptnSLIProviderMock) FetchAnalysisValueCalls() []struct { Ctx context.Context Query string Spec metricsapi.Analysis Provider *metricsapi.KeptnMetricsProvider }
FetchAnalysisValueCalls gets all the calls that were made to FetchAnalysisValue. Check the length with:
len(mockedKeptnSLIProvider.FetchAnalysisValueCalls())
Click to show internal directories.
Click to hide internal directories.