Documentation ¶
Index ¶
- func AddTestProcessResponse(response TestProcessResponse)
- func CheckLogEntries(t *testing.T, hook *test.Hook, message string)
- func CheckLogEntry(t *testing.T, hook *test.Hook, prefix string)
- func ClearTestProcessResponse()
- func ExtractMockedCommandAndArgs() (string, []string)
- func FakeExecCommand(command string, args ...string) *exec.Cmd
- func MockInitSudo()
- func MockWithStdOut(stdOut string, returnStatus int, cmd string, args ...string)
- func MockWithoutResponse(returnStatus int, cmd string, args ...string)
- func SetTestProcessResponse(response TestProcessResponse)
- func SetTestProcessResponses(responses []TestProcessResponse)
- func StandardHelperProcess(_ *testing.T)
- func StartCommandLineTest()
- func StopCommandLineTest()
- type TestProcessResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTestProcessResponse ¶
func AddTestProcessResponse(response TestProcessResponse)
func CheckLogEntries ¶
CheckLogEntries checks the latest logged entry if the message begin with the given prefix. If the prefix is "" then it expects that no log messages were written.
func CheckLogEntry ¶
CheckLogEntry checks the latest logged entry if the message begin with the given prefix. If the prefix is "" then it expects that no log messages were written.
func ClearTestProcessResponse ¶
func ClearTestProcessResponse()
func ExtractMockedCommandAndArgs ¶
Extract the command name and arguments of the mocked exec call using FakeExecCommand()
func FakeExecCommand ¶
This command fakes the exec command. This should be only used in Tests.
func MockInitSudo ¶
func MockInitSudo()
MockInitSudo adds the TestProcessResponse for `sh.initSudo` to `testutils.testProcessResponses`.
func MockWithStdOut ¶
func MockWithoutResponse ¶
MockWithoutResponse adds a simple TestProcessResponse.
func SetTestProcessResponse ¶
func SetTestProcessResponse(response TestProcessResponse)
func SetTestProcessResponses ¶
func SetTestProcessResponses(responses []TestProcessResponse)
func StandardHelperProcess ¶
func StartCommandLineTest ¶
func StartCommandLineTest()
StartCommandLineTest initializes everything that is needed for commandline tests.
func StopCommandLineTest ¶
func StopCommandLineTest()
StopCommandLineTests reset the changes from StartCommandLineTest.
Types ¶
type TestProcessResponse ¶
type TestProcessResponse struct { Command string Args []string ResponseStatus int Stdout string Stderr string ExpectedStdin string Delay time.Duration // AltResponseStatus will be returned if stdin got something else as expected AltResponseStatus int }
func FindTestProcessResponse ¶
func FindTestProcessResponse(responses []TestProcessResponse, cmd string, args []string) *TestProcessResponse