functional_test.go | |
---|---|
|
|
Implementation of functional tests for the CLI client (application). These tests start CLI client, send commands to it and check the output (if it is the same as expected). In order to work properly, the CLI client needs to be configured to not to use TAB-completion and color output needs to be disabled as well. Additionally, the controller service needs to be started in background, because CLI client calls this service for almost all commands. |
|
Documentation in literate-programming-style is available at: https://redhatinsights.github.io/insights-operator-cli/packages/tests/functional_test.html |
|
startCLI function starts CLI application w/o color output and w/o command-line completer. |
|
we need to know the current working directory so the CLI tool will be started from the right place (tests might be stored in different sub-directory) |
|
try to traverse through super-directories |
|
start the CLI tool |
|
now, after the start, we should see prompt |
|
quitCLI function quits CLI tool that was started as children |
|
check if child process has been started before |
|
the 'quit' command should quit the application |
|
make it breath a bit |
|
expectOutput function expects the specified output from the tested CLI client. |
|
check if the expected output has been displayed |
|
expectPrompt function expects the prompt from the tested CLI client. |
|
sendCommand sends command to the tested CLI client. |
|
send a command to the tested CLI client |
|