Documentation
¶
Overview ¶
Package exec is a generated GoMock package.
Index ¶
Constants ¶
const DefaultDockerExecutorDir = "/build"
DefaultDockerExecutorDir is the path to the execution root within the Docker container
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ExecOpts ¶
type ExecOpts struct {
Name string
Command string
WorkingDirectory string
Stdout io.Writer
Stderr io.Writer
Cmdout io.Writer
Env []string
Image string
Debug bool
}
ExecOpts are options used to run a command
type Executor ¶
type Executor interface {
// Execute a command
Execute(ctx context.Context, opts ExecOpts) error
// UsesDocker indicates whether this executor runs commands in a container
UsesDocker() bool
// ExecutorPath returns the corresponding path within the executor
// environment that corresponds to the given path on the host. For
// simple executors this will be identical. For executors that run
// inside Docker containers, that path will be translated to the
// path within the container filesystem. The provided path must be
// an absolute path on the host, and the returned path is also an
// absolute path. An error is returned if a relative path is provided
// or if the host path is not mapped within the executor.
ExecutorPath(hostPath string) (string, error)
}
Executor is an interface for executing commands
func NewBashExecutor ¶
func NewBashExecutor() Executor
NewBashExecutor returns an Executor that runs commands via bash
func NewDockerExecutor ¶
NewDockerExecutor returns an Executor that runs commands within containers
type FakeExecutor ¶
FakeExecutor wraps another Executor and allows overriding the UsesDocker result
func (*FakeExecutor) Execute ¶
func (e *FakeExecutor) Execute(ctx context.Context, opts ExecOpts) error
func (*FakeExecutor) ExecutorPath ¶
func (e *FakeExecutor) ExecutorPath(hostPath string) (string, error)
func (*FakeExecutor) UsesDocker ¶
func (e *FakeExecutor) UsesDocker() bool
type MockExecutor ¶
type MockExecutor struct {
// contains filtered or unexported fields
}
MockExecutor is a mock of Executor interface
func NewMockExecutor ¶
func NewMockExecutor(ctrl *gomock.Controller) *MockExecutor
NewMockExecutor creates a new mock instance
func (*MockExecutor) EXPECT ¶
func (m *MockExecutor) EXPECT() *MockExecutorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockExecutor) Execute ¶
func (m *MockExecutor) Execute(ctx context.Context, opts ExecOpts) error
Execute mocks base method
func (*MockExecutor) ExecutorPath ¶
func (m *MockExecutor) ExecutorPath(hostPath string) (string, error)
ExecutorPath mocks base method
func (*MockExecutor) UsesDocker ¶
func (m *MockExecutor) UsesDocker() bool
UsesDocker mocks base method
type MockExecutorMockRecorder ¶
type MockExecutorMockRecorder struct {
// contains filtered or unexported fields
}
MockExecutorMockRecorder is the mock recorder for MockExecutor
func (*MockExecutorMockRecorder) Execute ¶
func (mr *MockExecutorMockRecorder) Execute(ctx, opts interface{}) *gomock.Call
Execute indicates an expected call of Execute
func (*MockExecutorMockRecorder) ExecutorPath ¶
func (mr *MockExecutorMockRecorder) ExecutorPath(hostPath interface{}) *gomock.Call
ExecutorPath indicates an expected call of ExecutorPath
func (*MockExecutorMockRecorder) UsesDocker ¶
func (mr *MockExecutorMockRecorder) UsesDocker() *gomock.Call
UsesDocker indicates an expected call of UsesDocker