mock

package
v1.7.14 Latest Latest
Warning

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

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

Documentation

Overview

Copyright (C) 2019-2024 vdaas.org vald team <vald@vdaas.org>

Licensed under the Apache License, Version 2.0 (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package mock provides mock implementation for testing.

Copyright (C) 2019-2024 vdaas.org vald team <vald@vdaas.org>

Licensed under the Apache License, Version 2.0 (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (C) 2019-2024 vdaas.org vald team <vald@vdaas.org>

Licensed under the Apache License, Version 2.0 (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallOption added in v1.7.9

type CallOption = grpc.CallOption

type ClientConn added in v1.7.9

type ClientConn = pool.ClientConn

type ClientInternal added in v1.7.9

type ClientInternal struct {
	mock.Mock
}

func (*ClientInternal) Close added in v1.7.9

func (c *ClientInternal) Close(ctx context.Context) error

func (*ClientInternal) Connect added in v1.7.9

func (c *ClientInternal) Connect(
	ctx context.Context, addr string, dopts ...DialOption,
) (pool.Conn, error)

func (*ClientInternal) ConnectedAddrs added in v1.7.9

func (c *ClientInternal) ConnectedAddrs() []string

func (*ClientInternal) Disconnect added in v1.7.9

func (c *ClientInternal) Disconnect(ctx context.Context, addr string) error

func (*ClientInternal) Do added in v1.7.9

func (c *ClientInternal) Do(
	ctx context.Context,
	addr string,
	f func(ctx context.Context,
		conn *ClientConn,
		copts ...CallOption) (any, error),
) (any, error)

func (*ClientInternal) GetBackoff added in v1.7.9

func (c *ClientInternal) GetBackoff() backoff.Backoff

func (*ClientInternal) GetCallOption added in v1.7.9

func (c *ClientInternal) GetCallOption() []CallOption

func (*ClientInternal) GetDialOption added in v1.7.9

func (c *ClientInternal) GetDialOption() []DialOption

func (*ClientInternal) IsConnected added in v1.7.9

func (c *ClientInternal) IsConnected(ctx context.Context, addr string) bool

func (*ClientInternal) OrderedRange added in v1.7.9

func (c *ClientInternal) OrderedRange(
	ctx context.Context,
	order []string,
	f func(ctx context.Context,
		addr string,
		conn *ClientConn,
		copts ...CallOption) error,
) error

func (*ClientInternal) OrderedRangeConcurrent added in v1.7.9

func (c *ClientInternal) OrderedRangeConcurrent(
	ctx context.Context,
	order []string,
	concurrency int,
	f func(ctx context.Context,
		addr string,
		conn *ClientConn,
		copts ...CallOption) error,
) error

func (*ClientInternal) Range added in v1.7.9

func (c *ClientInternal) Range(
	ctx context.Context,
	f func(ctx context.Context,
		addr string,
		conn *ClientConn,
		copts ...CallOption) error,
) error

func (*ClientInternal) RangeConcurrent added in v1.7.9

func (c *ClientInternal) RangeConcurrent(
	ctx context.Context,
	concurrency int,
	f func(ctx context.Context,
		addr string,
		conn *ClientConn,
		copts ...CallOption) error,
) error

func (*ClientInternal) RoundRobin added in v1.7.9

func (c *ClientInternal) RoundRobin(
	ctx context.Context,
	f func(ctx context.Context,
		conn *ClientConn,
		copts ...CallOption) (any, error),
) (any, error)

func (*ClientInternal) SetDisableResolveDNSAddr added in v1.7.14

func (c *ClientInternal) SetDisableResolveDNSAddr(addr string, distributed bool)

func (*ClientInternal) StartConnectionMonitor added in v1.7.9

func (c *ClientInternal) StartConnectionMonitor(ctx context.Context) (<-chan error, error)

type DialOption added in v1.7.9

type DialOption = pool.DialOption

type ListObjectStreamMock added in v1.7.7

type ListObjectStreamMock struct {
	ServerStreamTestifyMock
}

ListObjectStreamMock is a testify mock struct for ListObjectStream based on ServerStreamTestifyMock.

func (*ListObjectStreamMock) Send added in v1.7.7

type MockClient added in v1.7.11

type MockClient struct {
	client.Client
}

func (*MockClient) Create added in v1.7.11

func (*MockClient) Delete added in v1.7.11

func (*MockClient) DeleteAllOf added in v1.7.11

func (*MockClient) Get added in v1.7.11

func (*MockClient) Status added in v1.7.11

type MockManager added in v1.7.11

type MockManager struct {
	manager.Manager
}

func (*MockManager) GetClient added in v1.7.11

func (*MockManager) GetClient() client.Client

type MockSubResourceWriter added in v1.7.11

type MockSubResourceWriter struct {
	client.SubResourceWriter
}

func (*MockSubResourceWriter) Update added in v1.7.11

type ServerStreamMock

type ServerStreamMock struct {
	SetHeaderFunc  func(metadata.MD) error
	SendHeaderFunc func(metadata.MD) error
	SetTrailerFunc func(metadata.MD)
	ContextFunc    func() context.Context
	SendMsgFunc    func(any) error
	RecvMsgFunc    func(any) error
}

ServerStreamMock implements grpc.ServerStream mock implementation.

func (*ServerStreamMock) Context

func (m *ServerStreamMock) Context() context.Context

func (*ServerStreamMock) RecvMsg

func (m *ServerStreamMock) RecvMsg(msg any) error

func (*ServerStreamMock) SendHeader

func (m *ServerStreamMock) SendHeader(md metadata.MD) error

func (*ServerStreamMock) SendMsg

func (m *ServerStreamMock) SendMsg(msg any) error

func (*ServerStreamMock) SetHeader

func (m *ServerStreamMock) SetHeader(md metadata.MD) error

func (*ServerStreamMock) SetTrailer

func (m *ServerStreamMock) SetTrailer(md metadata.MD)

type ServerStreamTestifyMock added in v1.7.7

type ServerStreamTestifyMock struct {
	mock.Mock
}

ServerStreamTestifyMock is a testify mock struct for grpc.ServerStream. Define Send method on top of this for each specific usecases with your specific proto schema Go struct type.

func (*ServerStreamTestifyMock) Context added in v1.7.7

func (*ServerStreamTestifyMock) RecvMsg added in v1.7.7

func (*ServerStreamTestifyMock) RecvMsg(_ any) error

func (*ServerStreamTestifyMock) SendHeader added in v1.7.7

func (*ServerStreamTestifyMock) SendMsg added in v1.7.7

func (*ServerStreamTestifyMock) SendMsg(_ any) error

func (*ServerStreamTestifyMock) SendMsgWithContext added in v1.7.7

func (*ServerStreamTestifyMock) SendMsgWithContext(_ context.Context, _ any) error

func (*ServerStreamTestifyMock) SetHeader added in v1.7.7

func (*ServerStreamTestifyMock) SetTrailer added in v1.7.7

func (*ServerStreamTestifyMock) SetTrailer(metadata.MD)

type StreamInsertServerMock

type StreamInsertServerMock struct {
	SendFunc func(*payload.Object_StreamLocation) error
	RecvFunc func() (*payload.Insert_Request, error)
	grpc.ServerStream
}

func (*StreamInsertServerMock) Recv

func (*StreamInsertServerMock) Send

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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