testpachd

package
v1.10.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithMockEnv

func WithMockEnv(cb func(*MockEnv) error) error

WithMockEnv sets up a MockEnv structure, passes it to the provided callback, then cleans up everything in the environment, regardless of if an assertion fails.

func WithRealEnv

func WithRealEnv(cb func(*RealEnv) error) error

WithRealEnv constructs a MockEnv, then forwards all API calls to go to API server instances for supported operations. PPS requires a kubernetes environment in order to spin up pipelines, which is not yet supported by this package, but the other API servers work.

Types

type MockEnv

type MockEnv struct {
	testetcd.EtcdEnv
	MockPachd  *MockPachd
	PachClient *client.APIClient
}

MockEnv contains the basic setup for running end-to-end pachyderm tests entirely locally within the test process. It provides a temporary directory for storing data, an embedded etcd server with a connected client, as well as a local mock pachd instance which allows a test to hook into any pachd calls.

type MockPachd

type MockPachd struct {
	Addr net.Addr

	Object      mockObjectServer
	PFS         mockPFSServer
	PPS         mockPPSServer
	Auth        mockAuthServer
	Transaction mockTransactionServer
	Enterprise  mockEnterpriseServer
	Version     mockVersionServer
	Admin       mockAdminServer
	// contains filtered or unexported fields
}

MockPachd provides an interface for running the interface for a Pachd API server locally without any of its dependencies. Tests may mock out specific API calls by providing a handler function, and later check information about the mocked calls.

func NewMockPachd

func NewMockPachd(ctx context.Context) (*MockPachd, error)

NewMockPachd constructs a mock Pachd API server whose behavior can be controlled through the MockPachd instance. By default, all API calls will error, unless a handler is specified.

func (*MockPachd) Close

func (mock *MockPachd) Close() error

Close will cancel the mock Pachd API server goroutine and return its result

func (*MockPachd) Err

func (mock *MockPachd) Err() <-chan error

Err returns a read-only channel that will receive the first error that occurs in the server group (stopping all the servers).

type RealEnv

type RealEnv struct {
	MockEnv

	AuthServer        authserver.APIServer
	PFSBlockServer    pfsserver.BlockAPIServer
	PFSServer         pfsserver.APIServer
	TransactionServer txnserver.APIServer
	// contains filtered or unexported fields
}

RealEnv contains a setup for running end-to-end pachyderm tests locally. It includes the base MockEnv struct as well as a real instance of the API server. These calls can still be mocked, but they default to calling into the real server endpoints.

Jump to

Keyboard shortcuts

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