fake

package
v0.0.0-...-9d026b8 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

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())

Jump to

Keyboard shortcuts

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