wrmock

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockWR

type MockWR struct {
	Cmd                   string
	Fail                  bool
	PollForStatusInterval time.Duration
	JobDuration           time.Duration

	sync.RWMutex
	ReturnStatus wr.WRJobStatus
}

MockWR can be used to test a build.Builder without having real wr running.

func NewMockWR

func NewMockWR(pollForStatusInterval, jobDuration time.Duration) *MockWR

NewMockWR returns a new MockWR that will wait pollForStatusInterval during WaitForRunning() and jobDuration during Wait().

func (*MockWR) Add

func (m *MockWR) Add(cmd string) (string, error)

Add implements build.Runner interface.

func (*MockWR) GetLastCmd

func (m *MockWR) GetLastCmd() string

GetLastCmd returns the last cmd Add()ed.

func (*MockWR) SetComplete

func (m *MockWR) SetComplete()

SetComplete can be used to mock a job that finished running.

func (*MockWR) SetRunning

func (m *MockWR) SetRunning()

SetRunning can be used to mock a job that started running.

func (*MockWR) Status

func (m *MockWR) Status(string) (wr.WRJobStatus, error)

Status implements build.Runner interface.

func (*MockWR) Wait

func (m *MockWR) Wait(string) (wr.WRJobStatus, error)

Wait implements build.Runner interface.

func (*MockWR) WaitForRunning

func (m *MockWR) WaitForRunning(string) error

WaitForRunning implements build.Runner interface.

Jump to

Keyboard shortcuts

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