mirror of https://github.com/ansible/ansible.git
ansible-test - Fix subprocess management. (#77638)
* Run code-smell sanity tests in UTF-8 Mode. * Update subprocess use in sanity test programs. * Use raw_command instead of run_command with always=True set. * Add more capture=True usage. * Don't expose stdin to subprocesses. * Capture more output. Warn on retry. * Add more captures. * Capture coverage cli output. * Capture windows and network host checks. * Be explicit about interactive usage. * Use a shell for non-captured, non-interactive subprocesses. * Add integration test to assert no TTY. * Add unit test to assert no TTY. * Require blocking stdin/stdout/stderr. * Use subprocess.run in ansible-core sanity tests. * Remove unused arg. * Be explicit with subprocess.run check=False. * Add changelog.pull/77639/head
parent
b8793fa48d
commit
62d03c8e75
@ -0,0 +1,10 @@
|
|||||||
|
bugfixes:
|
||||||
|
- ansible-test - Subprocesses are now isolated from the stdin, stdout and stderr of ansible-test.
|
||||||
|
This avoids issues with subprocesses tampering with the file descriptors, such as SSH making them non-blocking.
|
||||||
|
As a result of this change, subprocess output from unit and integration tests on stderr now go to stdout.
|
||||||
|
- ansible-test - Subprocesses no longer have access to the TTY ansible-test is connected to, if any.
|
||||||
|
This maintains consistent behavior between local testing and CI systems, which typically do not provide a TTY.
|
||||||
|
Tests which require a TTY should use pexpect or another mechanism to create a PTY.
|
||||||
|
minor_changes:
|
||||||
|
- ansible-test - Blocking mode is now enforced for stdin, stdout and stderr.
|
||||||
|
If any of these are non-blocking then ansible-test will exit during startup with an error.
|
@ -0,0 +1,2 @@
|
|||||||
|
context/controller
|
||||||
|
shippable/posix/group1
|
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
assert not sys.stdin.isatty()
|
||||||
|
assert not sys.stdout.isatty()
|
||||||
|
assert not sys.stderr.isatty()
|
@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
./runme.py
|
@ -0,0 +1,7 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def test_no_tty():
|
||||||
|
assert not sys.stdin.isatty()
|
||||||
|
assert not sys.stdout.isatty()
|
||||||
|
assert not sys.stderr.isatty()
|
Loading…
Reference in New Issue