console

package
v0.0.0-...-1111fac Latest Latest
Warning

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

Go to latest
Published: May 29, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PromptExpression = `(\$ |\# )`
	CRLF             = "\r\n"
)

Variables

This section is empty.

Functions

func ExpectBatchWithValidatedSend

func ExpectBatchWithValidatedSend(expecter expect.Expecter, batch []expect.Batcher, timeout time.Duration) ([]expect.BatchRes, error)

ExpectBatchWithValidatedSend adds the expect.BSnd command to the exect.BExp expression. It is done to make sure the match was found in the result of the expect.BSnd command and not in a leftover that wasn't removed from the buffer. NOTE: the method contains the following limitations:

  • Use of `BatchSwitchCase`
  • Multiline commands
  • No more than one sequential send or receive

func NewExpecter

func NewExpecter(virtCli kubecli.KubevirtClient, vmi *v1.VirtualMachineInstance, timeout time.Duration, opts ...expect.Option) (expect.Expecter, <-chan error, error)

NewExpecter will connect to an already logged in VMI console and return the generated expecter it will wait `timeout` for the connection.

func RetValue

func RetValue(retcode string) string

func RunCommand

func RunCommand(vmi *v1.VirtualMachineInstance, command string, timeout time.Duration) ([]expect.BatchRes, error)

RunCommand runs the command line from `command` connecting to an already logged in console at vmi and waiting `timeout` for command to return.

func SafeExpectBatchWithResponse

func SafeExpectBatchWithResponse(vmi *v1.VirtualMachineInstance, expected []expect.Batcher, timeout time.Duration) ([]expect.BatchRes, error)

SafeExpectBatchWithResponse runs the batch from `expected`, connecting to a VMI's console and waiting `wait` seconds for the batch to return with a response. It validates that the commands arrive to the console.

Types

This section is empty.

Jump to

Keyboard shortcuts

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