Skip to content

Commit

Permalink
Add STDIN I/O pipe regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
justin-stephenson committed Apr 20, 2020
1 parent a473529 commit f688286
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/tlitest/test_tlog_rec_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import time
import inspect
from tempfile import mkdtemp

from subprocess import Popen, PIPE, STDOUT
import pytest

from misc import check_recording, mklogfile, mkcfgfile, \
Expand Down Expand Up @@ -203,6 +203,17 @@ def test_session_record_with_different_shell(self):
check_recording(shell, '/usr/bin/tcsh', logfile)
shell.sendline('exit')

def test_session_record_pipe_io_stdin(self):
"""
Pipe I/O through stdin
"""
text_in_stdio = 'print("hello world")\n'
text_out = "hello world"
p = Popen(['sshpass', '-p', 'Secret123', 'ssh', 'tlitestlocaluser2@localhost', 'python3.7'],
stdout=PIPE, stdin=PIPE, stderr=PIPE, encoding='utf8')
stdout_data = p.communicate(input=text_in_stdio)[0]
assert text_out in stdout_data

@classmethod
def teardown_class(cls):
""" Copy original conf file back into place """
Expand Down
1 change: 1 addition & 0 deletions src/tlitest/tlitest-setup
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ python3-pytest
python3-pexpect
python3-systemd
tcsh
sshpass
tlog
"
PKGSFILE="/tmp/tlitest-setup_packages_found"
Expand Down

0 comments on commit f688286

Please sign in to comment.