command

package
v0.0.0-...-e050086 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2024 Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2024 Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2024 Datadog, Inc.

Index

Constants

View Source
const (
	NotFoundProcessExitCode = -1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BackgroundCmd

type BackgroundCmd interface {
	Start() error
	KeepAlive()
	Stop() error
	DryRun() bool
}

BackgroundCmd wraps a ContextCmd methods to provide monitorability of a ContextCmd that is launched in background

func NewBackgroundCmd

func NewBackgroundCmd(cmd Cmd, log *zap.SugaredLogger, processManager process.Manager) BackgroundCmd

type BackgroundCmdMock

type BackgroundCmdMock struct {
	mock.Mock
}

BackgroundCmdMock is an autogenerated mock type for the BackgroundCmd type

func NewBackgroundCmdMock

func NewBackgroundCmdMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *BackgroundCmdMock

NewBackgroundCmdMock creates a new instance of BackgroundCmdMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*BackgroundCmdMock) DryRun

func (_m *BackgroundCmdMock) DryRun() bool

DryRun provides a mock function with given fields:

func (*BackgroundCmdMock) EXPECT

func (*BackgroundCmdMock) KeepAlive

func (_m *BackgroundCmdMock) KeepAlive()

KeepAlive provides a mock function with given fields:

func (*BackgroundCmdMock) Start

func (_m *BackgroundCmdMock) Start() error

Start provides a mock function with given fields:

func (*BackgroundCmdMock) Stop

func (_m *BackgroundCmdMock) Stop() error

Stop provides a mock function with given fields:

type BackgroundCmdMock_DryRun_Call

type BackgroundCmdMock_DryRun_Call struct {
	*mock.Call
}

BackgroundCmdMock_DryRun_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DryRun'

func (*BackgroundCmdMock_DryRun_Call) Return

func (*BackgroundCmdMock_DryRun_Call) Run

func (*BackgroundCmdMock_DryRun_Call) RunAndReturn

type BackgroundCmdMock_Expecter

type BackgroundCmdMock_Expecter struct {
	// contains filtered or unexported fields
}

func (*BackgroundCmdMock_Expecter) DryRun

DryRun is a helper method to define mock.On call

func (*BackgroundCmdMock_Expecter) KeepAlive

KeepAlive is a helper method to define mock.On call

func (*BackgroundCmdMock_Expecter) Start

Start is a helper method to define mock.On call

func (*BackgroundCmdMock_Expecter) Stop

Stop is a helper method to define mock.On call

type BackgroundCmdMock_KeepAlive_Call

type BackgroundCmdMock_KeepAlive_Call struct {
	*mock.Call
}

BackgroundCmdMock_KeepAlive_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'KeepAlive'

func (*BackgroundCmdMock_KeepAlive_Call) Return

func (*BackgroundCmdMock_KeepAlive_Call) Run

func (*BackgroundCmdMock_KeepAlive_Call) RunAndReturn

type BackgroundCmdMock_Start_Call

type BackgroundCmdMock_Start_Call struct {
	*mock.Call
}

BackgroundCmdMock_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'

func (*BackgroundCmdMock_Start_Call) Return

func (*BackgroundCmdMock_Start_Call) Run

func (*BackgroundCmdMock_Start_Call) RunAndReturn

func (_c *BackgroundCmdMock_Start_Call) RunAndReturn(run func() error) *BackgroundCmdMock_Start_Call

type BackgroundCmdMock_Stop_Call

type BackgroundCmdMock_Stop_Call struct {
	*mock.Call
}

BackgroundCmdMock_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'

func (*BackgroundCmdMock_Stop_Call) Return

func (*BackgroundCmdMock_Stop_Call) Run

func (*BackgroundCmdMock_Stop_Call) RunAndReturn

func (_c *BackgroundCmdMock_Stop_Call) RunAndReturn(run func() error) *BackgroundCmdMock_Stop_Call

type Cmd

type Cmd interface {
	Start() error
	String() string
	Wait() error
	PID() int
	ExitCode() int
	DryRun() bool
}

Cmd aims to be a convenient wrapper around os/exec.CommandContext to ease testing and move some process methods up (PID/ExitCode)

type CmdMock

type CmdMock struct {
	mock.Mock
}

CmdMock is an autogenerated mock type for the Cmd type

func NewCmdMock

func NewCmdMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *CmdMock

NewCmdMock creates a new instance of CmdMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*CmdMock) DryRun

func (_m *CmdMock) DryRun() bool

DryRun provides a mock function with given fields:

func (*CmdMock) EXPECT

func (_m *CmdMock) EXPECT() *CmdMock_Expecter

func (*CmdMock) ExitCode

func (_m *CmdMock) ExitCode() int

ExitCode provides a mock function with given fields:

func (*CmdMock) PID

func (_m *CmdMock) PID() int

PID provides a mock function with given fields:

func (*CmdMock) Start

func (_m *CmdMock) Start() error

Start provides a mock function with given fields:

func (*CmdMock) String

func (_m *CmdMock) String() string

String provides a mock function with given fields:

func (*CmdMock) Wait

func (_m *CmdMock) Wait() error

Wait provides a mock function with given fields:

type CmdMock_DryRun_Call

type CmdMock_DryRun_Call struct {
	*mock.Call
}

CmdMock_DryRun_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DryRun'

func (*CmdMock_DryRun_Call) Return

func (_c *CmdMock_DryRun_Call) Return(_a0 bool) *CmdMock_DryRun_Call

func (*CmdMock_DryRun_Call) Run

func (_c *CmdMock_DryRun_Call) Run(run func()) *CmdMock_DryRun_Call

func (*CmdMock_DryRun_Call) RunAndReturn

func (_c *CmdMock_DryRun_Call) RunAndReturn(run func() bool) *CmdMock_DryRun_Call

type CmdMock_ExitCode_Call

type CmdMock_ExitCode_Call struct {
	*mock.Call
}

CmdMock_ExitCode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExitCode'

func (*CmdMock_ExitCode_Call) Return

func (*CmdMock_ExitCode_Call) Run

func (_c *CmdMock_ExitCode_Call) Run(run func()) *CmdMock_ExitCode_Call

func (*CmdMock_ExitCode_Call) RunAndReturn

func (_c *CmdMock_ExitCode_Call) RunAndReturn(run func() int) *CmdMock_ExitCode_Call

type CmdMock_Expecter

type CmdMock_Expecter struct {
	// contains filtered or unexported fields
}

func (*CmdMock_Expecter) DryRun

func (_e *CmdMock_Expecter) DryRun() *CmdMock_DryRun_Call

DryRun is a helper method to define mock.On call

func (*CmdMock_Expecter) ExitCode

func (_e *CmdMock_Expecter) ExitCode() *CmdMock_ExitCode_Call

ExitCode is a helper method to define mock.On call

func (*CmdMock_Expecter) PID

PID is a helper method to define mock.On call

func (*CmdMock_Expecter) Start

func (_e *CmdMock_Expecter) Start() *CmdMock_Start_Call

Start is a helper method to define mock.On call

func (*CmdMock_Expecter) String

func (_e *CmdMock_Expecter) String() *CmdMock_String_Call

String is a helper method to define mock.On call

func (*CmdMock_Expecter) Wait

func (_e *CmdMock_Expecter) Wait() *CmdMock_Wait_Call

Wait is a helper method to define mock.On call

type CmdMock_PID_Call

type CmdMock_PID_Call struct {
	*mock.Call
}

CmdMock_PID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PID'

func (*CmdMock_PID_Call) Return

func (_c *CmdMock_PID_Call) Return(_a0 int) *CmdMock_PID_Call

func (*CmdMock_PID_Call) Run

func (_c *CmdMock_PID_Call) Run(run func()) *CmdMock_PID_Call

func (*CmdMock_PID_Call) RunAndReturn

func (_c *CmdMock_PID_Call) RunAndReturn(run func() int) *CmdMock_PID_Call

type CmdMock_Start_Call

type CmdMock_Start_Call struct {
	*mock.Call
}

CmdMock_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'

func (*CmdMock_Start_Call) Return

func (_c *CmdMock_Start_Call) Return(_a0 error) *CmdMock_Start_Call

func (*CmdMock_Start_Call) Run

func (_c *CmdMock_Start_Call) Run(run func()) *CmdMock_Start_Call

func (*CmdMock_Start_Call) RunAndReturn

func (_c *CmdMock_Start_Call) RunAndReturn(run func() error) *CmdMock_Start_Call

type CmdMock_String_Call

type CmdMock_String_Call struct {
	*mock.Call
}

CmdMock_String_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'String'

func (*CmdMock_String_Call) Return

func (*CmdMock_String_Call) Run

func (_c *CmdMock_String_Call) Run(run func()) *CmdMock_String_Call

func (*CmdMock_String_Call) RunAndReturn

func (_c *CmdMock_String_Call) RunAndReturn(run func() string) *CmdMock_String_Call

type CmdMock_Wait_Call

type CmdMock_Wait_Call struct {
	*mock.Call
}

CmdMock_Wait_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Wait'

func (*CmdMock_Wait_Call) Return

func (_c *CmdMock_Wait_Call) Return(_a0 error) *CmdMock_Wait_Call

func (*CmdMock_Wait_Call) Run

func (_c *CmdMock_Wait_Call) Run(run func()) *CmdMock_Wait_Call

func (*CmdMock_Wait_Call) RunAndReturn

func (_c *CmdMock_Wait_Call) RunAndReturn(run func() error) *CmdMock_Wait_Call

type Factory

type Factory interface {
	NewCmd(ctx context.Context, name string, args []string) Cmd
}

Factory defines how we want to create a command (with context and with relevant fields set)

func NewFactory

func NewFactory(dryRun bool) Factory

type FactoryMock

type FactoryMock struct {
	mock.Mock
}

FactoryMock is an autogenerated mock type for the Factory type

func NewFactoryMock

func NewFactoryMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *FactoryMock

NewFactoryMock creates a new instance of FactoryMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*FactoryMock) EXPECT

func (_m *FactoryMock) EXPECT() *FactoryMock_Expecter

func (*FactoryMock) NewCmd

func (_m *FactoryMock) NewCmd(ctx context.Context, name string, args []string) Cmd

NewCmd provides a mock function with given fields: ctx, name, args

type FactoryMock_Expecter

type FactoryMock_Expecter struct {
	// contains filtered or unexported fields
}

func (*FactoryMock_Expecter) NewCmd

func (_e *FactoryMock_Expecter) NewCmd(ctx interface{}, name interface{}, args interface{}) *FactoryMock_NewCmd_Call

NewCmd is a helper method to define mock.On call

  • ctx context.Context
  • name string
  • args []string

type FactoryMock_NewCmd_Call

type FactoryMock_NewCmd_Call struct {
	*mock.Call
}

FactoryMock_NewCmd_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewCmd'

func (*FactoryMock_NewCmd_Call) Return

func (*FactoryMock_NewCmd_Call) Run

func (_c *FactoryMock_NewCmd_Call) Run(run func(ctx context.Context, name string, args []string)) *FactoryMock_NewCmd_Call

func (*FactoryMock_NewCmd_Call) RunAndReturn

Jump to

Keyboard shortcuts

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