pachyderm: github.com/pachyderm/pachyderm/src/server/pkg/testpachd Index | Files

package testpachd

import "github.com/pachyderm/pachyderm/src/server/pkg/testpachd"

Index

Package Files

mock_env.go mock_pachd.go mock_transaction.go real_env.go

func WithMockEnv Uses

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 Uses

func WithRealEnv(cb func(*RealEnv) error, customConfig ...*serviceenv.PachdFullConfiguration) 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.

type MockEnv Uses

type MockEnv struct {
    testetcd.Env
    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 MockPPSTransactionServer Uses

type MockPPSTransactionServer struct {
    UpdateJobStateInTransaction mockUpdateJobStateInTransaction
    // contains filtered or unexported fields
}

MockPPSTransactionServer provides a mocking interface for overriding PPS behavior inside transactions.

func NewMockPPSTransactionServer Uses

func NewMockPPSTransactionServer() *MockPPSTransactionServer

NewMockPPSTransactionServer instantiates a MockPPSTransactionServer

type MockPachd Uses

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 Uses

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 Uses

func (mock *MockPachd) Close() error

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

func (*MockPachd) Err Uses

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 Uses

type RealEnv struct {
    MockEnv

    LocalStorageDirectory string

    AuthServer               authserver.APIServer
    PFSBlockServer           pfsserver.BlockAPIServer
    PFSServer                pfsserver.APIServer
    TransactionServer        txnserver.APIServer
    MockPPSTransactionServer *MockPPSTransactionServer
    // 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.

Package testpachd imports 26 packages (graph). Updated 2020-08-12. Refresh now. Tools for package owners.