Documentation ¶
Index ¶
- Constants
- func ExpectBatchWithValidatedSend(expecter expect.Expecter, batch []expect.Batcher, timeout time.Duration) ([]expect.BatchRes, error)
- func NewExpecter(virtCli kubecli.KubevirtClient, vmi *v1.VirtualMachineInstance, ...) (expect.Expecter, <-chan error, error)
- func RetValue(retcode string) string
- func RunCommand(vmi *v1.VirtualMachineInstance, command string, timeout time.Duration) ([]expect.BatchRes, error)
- func SafeExpectBatchWithResponse(vmi *v1.VirtualMachineInstance, expected []expect.Batcher, ...) ([]expect.BatchRes, error)
Constants ¶
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 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.