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 ¶
- type CallOption
- type ClientConn
- type ClientInternal
- func (c *ClientInternal) Close(ctx context.Context) error
- func (c *ClientInternal) Connect(ctx context.Context, addr string, dopts ...DialOption) (pool.Conn, error)
- func (c *ClientInternal) ConnectedAddrs() []string
- func (c *ClientInternal) Disconnect(ctx context.Context, addr string) error
- func (c *ClientInternal) Do(ctx context.Context, addr string, ...) (any, error)
- func (c *ClientInternal) GetBackoff() backoff.Backoff
- func (c *ClientInternal) GetCallOption() []CallOption
- func (c *ClientInternal) GetDialOption() []DialOption
- func (c *ClientInternal) IsConnected(ctx context.Context, addr string) bool
- func (c *ClientInternal) OrderedRange(ctx context.Context, order []string, ...) error
- func (c *ClientInternal) OrderedRangeConcurrent(ctx context.Context, order []string, concurrency int, ...) error
- func (c *ClientInternal) Range(ctx context.Context, ...) error
- func (c *ClientInternal) RangeConcurrent(ctx context.Context, concurrency int, ...) error
- func (c *ClientInternal) RoundRobin(ctx context.Context, ...) (any, error)
- func (c *ClientInternal) SetDisableResolveDNSAddr(addr string, distributed bool)
- func (c *ClientInternal) StartConnectionMonitor(ctx context.Context) (<-chan error, error)
- type DialOption
- type ListObjectStreamMock
- type MockClient
- func (*MockClient) Create(context.Context, client.Object, ...client.CreateOption) error
- func (*MockClient) Delete(context.Context, client.Object, ...client.DeleteOption) error
- func (*MockClient) DeleteAllOf(context.Context, client.Object, ...client.DeleteAllOfOption) error
- func (*MockClient) Get(context.Context, client.ObjectKey, client.Object, ...client.GetOption) error
- func (*MockClient) Status() client.SubResourceWriter
- type MockManager
- type MockSubResourceWriter
- type ServerStreamMock
- func (m *ServerStreamMock) Context() context.Context
- func (m *ServerStreamMock) RecvMsg(msg any) error
- func (m *ServerStreamMock) SendHeader(md metadata.MD) error
- func (m *ServerStreamMock) SendMsg(msg any) error
- func (m *ServerStreamMock) SetHeader(md metadata.MD) error
- func (m *ServerStreamMock) SetTrailer(md metadata.MD)
- type ServerStreamTestifyMock
- func (*ServerStreamTestifyMock) Context() context.Context
- func (*ServerStreamTestifyMock) RecvMsg(_ any) error
- func (*ServerStreamTestifyMock) SendHeader(metadata.MD) error
- func (*ServerStreamTestifyMock) SendMsg(_ any) error
- func (*ServerStreamTestifyMock) SendMsgWithContext(_ context.Context, _ any) error
- func (*ServerStreamTestifyMock) SetHeader(metadata.MD) error
- func (*ServerStreamTestifyMock) SetTrailer(metadata.MD)
- type StreamInsertServerMock
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
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
func (losm *ListObjectStreamMock) Send(res *payload.Object_List_Response) error
type MockClient ¶ added in v1.7.11
func (*MockClient) Create ¶ added in v1.7.11
func (*MockClient) Create(context.Context, client.Object, ...client.CreateOption) error
func (*MockClient) Delete ¶ added in v1.7.11
func (*MockClient) Delete(context.Context, client.Object, ...client.DeleteOption) error
func (*MockClient) DeleteAllOf ¶ added in v1.7.11
func (*MockClient) DeleteAllOf(context.Context, client.Object, ...client.DeleteAllOfOption) error
func (*MockClient) Status ¶ added in v1.7.11
func (*MockClient) Status() client.SubResourceWriter
type MockManager ¶ added in v1.7.11
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
func (*MockSubResourceWriter) Update( context.Context, client.Object, ...client.SubResourceUpdateOption, ) error
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) SetTrailer ¶
func (m *ServerStreamMock) SetTrailer(md metadata.MD)
type ServerStreamTestifyMock ¶ added in v1.7.7
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) Context() context.Context
func (*ServerStreamTestifyMock) RecvMsg ¶ added in v1.7.7
func (*ServerStreamTestifyMock) RecvMsg(_ any) error
func (*ServerStreamTestifyMock) SendHeader ¶ added in v1.7.7
func (*ServerStreamTestifyMock) SendHeader(metadata.MD) error
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) SetHeader(metadata.MD) error
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 (m *StreamInsertServerMock) Recv() (*payload.Insert_Request, error)
func (*StreamInsertServerMock) Send ¶
func (m *StreamInsertServerMock) Send(l *payload.Object_StreamLocation) error