Documentation ¶
Overview ¶
Package fakevtctlclient contains a fake for the vtctlclient interface.
Index ¶
- type FakeLoggerEventStreamingClient
- func (f *FakeLoggerEventStreamingClient) RegisterResult(args []string, output string, err error) error
- func (f *FakeLoggerEventStreamingClient) RegisterResultForAddr(addr string, args []string, output string, err error) error
- func (f *FakeLoggerEventStreamingClient) RegisteredCommands() []string
- func (f *FakeLoggerEventStreamingClient) StreamResult(addr string, args []string) (logutil.EventStream, error)
- type FakeVtctlClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeLoggerEventStreamingClient ¶
type FakeLoggerEventStreamingClient struct {
// contains filtered or unexported fields
}
FakeLoggerEventStreamingClient is the base for the fakes for the vtctlclient and vtworkerclient. It allows to register a (multi-)line string for a given command and return the result as channel which streams it back.
func NewFakeLoggerEventStreamingClient ¶
func NewFakeLoggerEventStreamingClient() *FakeLoggerEventStreamingClient
NewFakeLoggerEventStreamingClient creates a new fake.
func (*FakeLoggerEventStreamingClient) RegisterResult ¶
func (f *FakeLoggerEventStreamingClient) RegisterResult(args []string, output string, err error) error
RegisterResult registers for a given command (args) the result which the fake should return. Once the result was returned, it will be automatically deregistered.
func (*FakeLoggerEventStreamingClient) RegisterResultForAddr ¶
func (f *FakeLoggerEventStreamingClient) RegisterResultForAddr(addr string, args []string, output string, err error) error
RegisterResultForAddr is identical to RegisterResult but also expects that the client did dial "addr" as server address.
func (*FakeLoggerEventStreamingClient) RegisteredCommands ¶
func (f *FakeLoggerEventStreamingClient) RegisteredCommands() []string
RegisteredCommands returns a list of commands which are currently registered. This is useful to check that all registered results have been consumed.
func (*FakeLoggerEventStreamingClient) StreamResult ¶
func (f *FakeLoggerEventStreamingClient) StreamResult(addr string, args []string) (logutil.EventStream, error)
StreamResult returns an EventStream which streams back a registered result as logging events. "addr" is the server address which the client dialed and may be empty.
type FakeVtctlClient ¶
type FakeVtctlClient struct {
*FakeLoggerEventStreamingClient
}
FakeVtctlClient is a fake which implements the vtctlclient interface. The fake can be used to return a specific result for a given command. If the command is not registered, an error will be thrown.
func NewFakeVtctlClient ¶
func NewFakeVtctlClient() *FakeVtctlClient
NewFakeVtctlClient creates a FakeVtctlClient struct.
func (*FakeVtctlClient) Close ¶
func (f *FakeVtctlClient) Close()
Close is part of the vtctlclient interface.
func (*FakeVtctlClient) ExecuteVtctlCommand ¶
func (f *FakeVtctlClient) ExecuteVtctlCommand(ctx context.Context, args []string, actionTimeout time.Duration) (logutil.EventStream, error)
ExecuteVtctlCommand is part of the vtctlclient interface.
func (*FakeVtctlClient) FakeVtctlClientFactory ¶
func (f *FakeVtctlClient) FakeVtctlClientFactory(addr string, dialTimeout time.Duration) (vtctlclient.VtctlClient, error)
FakeVtctlClientFactory always returns the current instance.