mocks

package
v3.0.1-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientMock

type ClientMock struct {
	// AddDocumentFunc mocks the AddDocument method.
	AddDocumentFunc func(ctx context.Context, indexName string, documentID string, document []byte, opts *client.AddDocumentOptions) error

	// BulkIndexAddFunc mocks the BulkIndexAdd method.
	BulkIndexAddFunc func(ctx context.Context, action client.BulkIndexerAction, index string, documentID string, document []byte) error

	// BulkIndexCloseFunc mocks the BulkIndexClose method.
	BulkIndexCloseFunc func(contextMoqParam context.Context) error

	// BulkUpdateFunc mocks the BulkUpdate method.
	BulkUpdateFunc func(ctx context.Context, indexName string, url string, settings []byte) ([]byte, error)

	// CheckerFunc mocks the Checker method.
	CheckerFunc func(ctx context.Context, state *health.CheckState) error

	// CountIndicesFunc mocks the CountIndices method.
	CountIndicesFunc func(ctx context.Context, indices []string) ([]byte, error)

	// CreateIndexFunc mocks the CreateIndex method.
	CreateIndexFunc func(ctx context.Context, indexName string, indexSettings []byte) error

	// DeleteIndexFunc mocks the DeleteIndex method.
	DeleteIndexFunc func(ctx context.Context, indexName string) error

	// DeleteIndicesFunc mocks the DeleteIndices method.
	DeleteIndicesFunc func(ctx context.Context, indices []string) error

	// GetAliasFunc mocks the GetAlias method.
	GetAliasFunc func(ctx context.Context) ([]byte, error)

	// GetIndicesFunc mocks the GetIndices method.
	GetIndicesFunc func(ctx context.Context, indexPatterns []string) ([]byte, error)

	// MultiSearchFunc mocks the MultiSearch method.
	MultiSearchFunc func(ctx context.Context, searches []client.Search) ([]byte, error)

	// NewBulkIndexerFunc mocks the NewBulkIndexer method.
	NewBulkIndexerFunc func(contextMoqParam context.Context) error

	// SearchFunc mocks the Search method.
	SearchFunc func(ctx context.Context, search client.Search) ([]byte, error)

	// UpdateAliasesFunc mocks the UpdateAliases method.
	UpdateAliasesFunc func(ctx context.Context, alias string, removeIndices []string, addIndices []string) error
	// contains filtered or unexported fields
}

ClientMock is a mock implementation of client.Client.

func TestSomethingThatUsesClient(t *testing.T) {

	// make and configure a mocked client.Client
	mockedClient := &ClientMock{
		AddDocumentFunc: func(ctx context.Context, indexName string, documentID string, document []byte, opts *client.AddDocumentOptions) error {
			panic("mock out the AddDocument method")
		},
		BulkIndexAddFunc: func(ctx context.Context, action client.BulkIndexerAction, index string, documentID string, document []byte) error {
			panic("mock out the BulkIndexAdd method")
		},
		BulkIndexCloseFunc: func(contextMoqParam context.Context) error {
			panic("mock out the BulkIndexClose method")
		},
		BulkUpdateFunc: func(ctx context.Context, indexName string, url string, settings []byte) ([]byte, error) {
			panic("mock out the BulkUpdate method")
		},
		CheckerFunc: func(ctx context.Context, state *health.CheckState) error {
			panic("mock out the Checker method")
		},
		CountIndicesFunc: func(ctx context.Context, indices []string) ([]byte, error) {
			panic("mock out the CountIndices method")
		},
		CreateIndexFunc: func(ctx context.Context, indexName string, indexSettings []byte) error {
			panic("mock out the CreateIndex method")
		},
		DeleteIndexFunc: func(ctx context.Context, indexName string) error {
			panic("mock out the DeleteIndex method")
		},
		DeleteIndicesFunc: func(ctx context.Context, indices []string) error {
			panic("mock out the DeleteIndices method")
		},
		GetAliasFunc: func(ctx context.Context) ([]byte, error) {
			panic("mock out the GetAlias method")
		},
		GetIndicesFunc: func(ctx context.Context, indexPatterns []string) ([]byte, error) {
			panic("mock out the GetIndices method")
		},
		MultiSearchFunc: func(ctx context.Context, searches []client.Search) ([]byte, error) {
			panic("mock out the MultiSearch method")
		},
		NewBulkIndexerFunc: func(contextMoqParam context.Context) error {
			panic("mock out the NewBulkIndexer method")
		},
		SearchFunc: func(ctx context.Context, search client.Search) ([]byte, error) {
			panic("mock out the Search method")
		},
		UpdateAliasesFunc: func(ctx context.Context, alias string, removeIndices []string, addIndices []string) error {
			panic("mock out the UpdateAliases method")
		},
	}

	// use mockedClient in code that requires client.Client
	// and then make assertions.

}

func (*ClientMock) AddDocument

func (mock *ClientMock) AddDocument(ctx context.Context, indexName string, documentID string, document []byte, opts *client.AddDocumentOptions) error

AddDocument calls AddDocumentFunc.

func (*ClientMock) AddDocumentCalls

func (mock *ClientMock) AddDocumentCalls() []struct {
	Ctx        context.Context
	IndexName  string
	DocumentID string
	Document   []byte
	Opts       *client.AddDocumentOptions
}

AddDocumentCalls gets all the calls that were made to AddDocument. Check the length with:

len(mockedClient.AddDocumentCalls())

func (*ClientMock) BulkIndexAdd

func (mock *ClientMock) BulkIndexAdd(ctx context.Context, action client.BulkIndexerAction, index string, documentID string, document []byte) error

BulkIndexAdd calls BulkIndexAddFunc.

func (*ClientMock) BulkIndexAddCalls

func (mock *ClientMock) BulkIndexAddCalls() []struct {
	Ctx        context.Context
	Action     client.BulkIndexerAction
	Index      string
	DocumentID string
	Document   []byte
}

BulkIndexAddCalls gets all the calls that were made to BulkIndexAdd. Check the length with:

len(mockedClient.BulkIndexAddCalls())

func (*ClientMock) BulkIndexClose

func (mock *ClientMock) BulkIndexClose(contextMoqParam context.Context) error

BulkIndexClose calls BulkIndexCloseFunc.

func (*ClientMock) BulkIndexCloseCalls

func (mock *ClientMock) BulkIndexCloseCalls() []struct {
	ContextMoqParam context.Context
}

BulkIndexCloseCalls gets all the calls that were made to BulkIndexClose. Check the length with:

len(mockedClient.BulkIndexCloseCalls())

func (*ClientMock) BulkUpdate

func (mock *ClientMock) BulkUpdate(ctx context.Context, indexName string, url string, settings []byte) ([]byte, error)

BulkUpdate calls BulkUpdateFunc.

func (*ClientMock) BulkUpdateCalls

func (mock *ClientMock) BulkUpdateCalls() []struct {
	Ctx       context.Context
	IndexName string
	URL       string
	Settings  []byte
}

BulkUpdateCalls gets all the calls that were made to BulkUpdate. Check the length with:

len(mockedClient.BulkUpdateCalls())

func (*ClientMock) Checker

func (mock *ClientMock) Checker(ctx context.Context, state *health.CheckState) error

Checker calls CheckerFunc.

func (*ClientMock) CheckerCalls

func (mock *ClientMock) CheckerCalls() []struct {
	Ctx   context.Context
	State *health.CheckState
}

CheckerCalls gets all the calls that were made to Checker. Check the length with:

len(mockedClient.CheckerCalls())

func (*ClientMock) CountIndices

func (mock *ClientMock) CountIndices(ctx context.Context, indices []string) ([]byte, error)

CountIndices calls CountIndicesFunc.

func (*ClientMock) CountIndicesCalls

func (mock *ClientMock) CountIndicesCalls() []struct {
	Ctx     context.Context
	Indices []string
}

CountIndicesCalls gets all the calls that were made to CountIndices. Check the length with:

len(mockedClient.CountIndicesCalls())

func (*ClientMock) CreateIndex

func (mock *ClientMock) CreateIndex(ctx context.Context, indexName string, indexSettings []byte) error

CreateIndex calls CreateIndexFunc.

func (*ClientMock) CreateIndexCalls

func (mock *ClientMock) CreateIndexCalls() []struct {
	Ctx           context.Context
	IndexName     string
	IndexSettings []byte
}

CreateIndexCalls gets all the calls that were made to CreateIndex. Check the length with:

len(mockedClient.CreateIndexCalls())

func (*ClientMock) DeleteIndex

func (mock *ClientMock) DeleteIndex(ctx context.Context, indexName string) error

DeleteIndex calls DeleteIndexFunc.

func (*ClientMock) DeleteIndexCalls

func (mock *ClientMock) DeleteIndexCalls() []struct {
	Ctx       context.Context
	IndexName string
}

DeleteIndexCalls gets all the calls that were made to DeleteIndex. Check the length with:

len(mockedClient.DeleteIndexCalls())

func (*ClientMock) DeleteIndices

func (mock *ClientMock) DeleteIndices(ctx context.Context, indices []string) error

DeleteIndices calls DeleteIndicesFunc.

func (*ClientMock) DeleteIndicesCalls

func (mock *ClientMock) DeleteIndicesCalls() []struct {
	Ctx     context.Context
	Indices []string
}

DeleteIndicesCalls gets all the calls that were made to DeleteIndices. Check the length with:

len(mockedClient.DeleteIndicesCalls())

func (*ClientMock) GetAlias

func (mock *ClientMock) GetAlias(ctx context.Context) ([]byte, error)

GetAlias calls GetAliasFunc.

func (*ClientMock) GetAliasCalls

func (mock *ClientMock) GetAliasCalls() []struct {
	Ctx context.Context
}

GetAliasCalls gets all the calls that were made to GetAlias. Check the length with:

len(mockedClient.GetAliasCalls())

func (*ClientMock) GetIndices

func (mock *ClientMock) GetIndices(ctx context.Context, indexPatterns []string) ([]byte, error)

GetIndices calls GetIndicesFunc.

func (*ClientMock) GetIndicesCalls

func (mock *ClientMock) GetIndicesCalls() []struct {
	Ctx           context.Context
	IndexPatterns []string
}

GetIndicesCalls gets all the calls that were made to GetIndices. Check the length with:

len(mockedClient.GetIndicesCalls())

func (*ClientMock) MultiSearch

func (mock *ClientMock) MultiSearch(ctx context.Context, searches []client.Search) ([]byte, error)

MultiSearch calls MultiSearchFunc.

func (*ClientMock) MultiSearchCalls

func (mock *ClientMock) MultiSearchCalls() []struct {
	Ctx      context.Context
	Searches []client.Search
}

MultiSearchCalls gets all the calls that were made to MultiSearch. Check the length with:

len(mockedClient.MultiSearchCalls())

func (*ClientMock) NewBulkIndexer

func (mock *ClientMock) NewBulkIndexer(contextMoqParam context.Context) error

NewBulkIndexer calls NewBulkIndexerFunc.

func (*ClientMock) NewBulkIndexerCalls

func (mock *ClientMock) NewBulkIndexerCalls() []struct {
	ContextMoqParam context.Context
}

NewBulkIndexerCalls gets all the calls that were made to NewBulkIndexer. Check the length with:

len(mockedClient.NewBulkIndexerCalls())

func (*ClientMock) Search

func (mock *ClientMock) Search(ctx context.Context, search client.Search) ([]byte, error)

Search calls SearchFunc.

func (*ClientMock) SearchCalls

func (mock *ClientMock) SearchCalls() []struct {
	Ctx    context.Context
	Search client.Search
}

SearchCalls gets all the calls that were made to Search. Check the length with:

len(mockedClient.SearchCalls())

func (*ClientMock) UpdateAliases

func (mock *ClientMock) UpdateAliases(ctx context.Context, alias string, removeIndices []string, addIndices []string) error

UpdateAliases calls UpdateAliasesFunc.

func (*ClientMock) UpdateAliasesCalls

func (mock *ClientMock) UpdateAliasesCalls() []struct {
	Ctx           context.Context
	Alias         string
	RemoveIndices []string
	AddIndices    []string
}

UpdateAliasesCalls gets all the calls that were made to UpdateAliases. Check the length with:

len(mockedClient.UpdateAliasesCalls())

Jump to

Keyboard shortcuts

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