stdinmatcher

package
v0.0.0-...-0821b2d Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitForAnyMatch

func WaitForAnyMatch(ctx context.Context, input io.Reader, matches []Matcher) (int, error)

WaitForAnyMatch waits for expected regex matches if function found a match, the first match index is return as index in the match slice If there was not match after timeout duration, timedout is set to true.

func WaitForRegex

func WaitForRegex(bmc BMC, matches []Matcher, timeoutWaitRegex time.Duration) (int, error)

WaitForRegex waits for any matches passed in a matches slice to appear in the BMC console for the expected number of times. If no matches, timedout is set to true.

Types

type BMC

type BMC interface {
	OpenSerialConsole(openConsoleCliCmd string) (io.Reader, io.WriteCloser, error)
	CloseSerialConsole() error
}

BMC is an interface used to abstract a BMC api that is able to open a console This is used by the unit test.

type Matcher

type Matcher struct {
	// Line regexp.
	Regex *regexp.Regexp
	// Num times (lines) that we're waiting the regex to match.
	Times int
}

Matcher struc to hold regex to match for and the minimum of matches expected.

Jump to

Keyboard shortcuts

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