Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport][ipa-4-9] ipatests: use pexpect for controlling interactive command line utilities #5514

Closed
wants to merge 3 commits into from

Conversation

abbra
Copy link
Contributor

@abbra abbra commented Feb 3, 2021

This PR was opened automatically because PR #5460 was pushed to master and backport to ipa-4-9 is required.

The pexpect module can be used for controlling and testing interactive
command-line programs. The wrapper adds testing-oriented features like
logging and automatic process termination and default check for process
exit status.
`ktutil` is a REPL-style utility that can be controlled only interactively.
The common approach of sending commands to stdin does not work with it on
systems where `readline` library has version less then 8.0 due to a bug
in that version.
With `pexpect` we avoid this bug because it emulates the terminal
when interacting with spawned process instead of simply sending all input
to stdin.
…nstall

During interactive session of `ipa-adtrust-install` the user needs to
answer several questions. This was done by sending all answers to
the processes stdin without analyzing the questions.

If the installation scenario changes at some point we can get on of the
following results:
* the test fails in the end and the root cause is not obvious
* if a new question was added
* test does not fail but answers are provided for wrong questions -
  in this case scope of test case changes without being noticed

If we use `pexpect` for controlling the session, the test will fail
immediately when it encounters unexpected question.
@abbra
Copy link
Contributor Author

abbra commented Feb 3, 2021

PR was ACKed automatically because this is backport of PR #5460. Wait for CI to finish before pushing. In case of questions or problems contact @wladich who is author of the original PR.

@abbra abbra added the ack Pull Request approved, can be merged label Feb 3, 2021
@wladich
Copy link

wladich commented Feb 3, 2021

Closing the PR since commit messages need to be updated with a link to pagure ticket. New PR will be created

@wladich wladich closed this Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged
Projects
None yet
3 participants