test

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package test mock executor heavily inspired from the Executor from github.com/rook/rook/pkg/util/exec pkg#

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockExecutor

type MockExecutor struct {
	executor.Executor
	MockExecuteCommand               func(ctx context.Context, actionName string, command string, arg ...string) error
	MockExecuteCommandWithOutput     func(ctx context.Context, actionName string, command string, arg ...string) (string, error)
	MockExecuteCommandWithOutputByte func(ctx context.Context, actionName string, command string, arg ...string) ([]byte, error)
	MockSetEnv                       func(e []string)
	// contains filtered or unexported fields
}

MockExecutor Mock Executor implementation for tests

func (MockExecutor) ExecuteCommand

func (ce MockExecutor) ExecuteCommand(ctx context.Context, actionName string, command string, arg ...string) error

ExecuteCommand execute a given command with its arguments but don't return any output

func (MockExecutor) ExecuteCommandWithOutput

func (ce MockExecutor) ExecuteCommandWithOutput(ctx context.Context, actionName string, command string, arg ...string) (string, error)

ExecuteCommandWithOutput execute a given command with its arguments and return the output as a string

func (MockExecutor) ExecuteCommandWithOutputByte

func (ce MockExecutor) ExecuteCommandWithOutputByte(ctx context.Context, actionName string, command string, arg ...string) ([]byte, error)

ExecuteCommandWithOutputByte execute a given command with its arguments and return the output as a byte array ([]byte)

func (MockExecutor) SetEnv added in v0.2.6

func (ce MockExecutor) SetEnv(e []string)

SetEnv set env for command execution

Jump to

Keyboard shortcuts

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