fakevtctlclient

package
v2.0.0-alpha2+incompat... Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2015 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package fakevtctlclient contains a fake for the vtctlclient interface.

Index

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.

func (*FakeLoggerEventStreamingClient) StreamResult

func (f *FakeLoggerEventStreamingClient) StreamResult(args []string) (<-chan *logutil.LoggerEvent, func() error, error)

StreamResult returns a channel which streams back a registered result as logging events.

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, lockTimeout time.Duration) (<-chan *logutil.LoggerEvent, vtctlclient.ErrFunc, 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.

Jump to

Keyboard shortcuts

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