def test_play_from_file(self): """ Check tlog-play can playback session from file """ logfile = mklogfile(self.tempdir) shell = ssh_pexpect(self.user1, 'Secret123', 'localhost') mkrecording(shell, logfile) shell.sendline('tlog-play -i {}'.format(logfile)) shell.expect('KNOWN BUGS')
def test_play_from_file(self): """ Check tlog-play can playback session from file """ logfile = mklogfile(self.tempdir) shell = ssh_pexpect(self.user1, 'Secret123', 'localhost') mkrecording(shell, logfile) shell.sendline('tlog-play -i {}'.format(logfile)) shell.expect('localhost')
def test_play_at_speed_x2(self): """ Check tlog-play can playback session at 2x speed """ logfile = mklogfile(self.tempdir) shell = ssh_pexpect(self.user1, 'Secret123', 'localhost') mkrecording(shell, logfile, sleep=15) shell.close() shell = ssh_pexpect(self.user1, 'Secret123', 'localhost') time_start = time.time() opts = '-i {} --speed=2'.format(logfile) shell.sendline('tlog-play {}'.format(opts)) shell.expect('KNOWN BUGS') time_stop = time.time() assert time_stop-time_start < 9
def test_play_at_speed_x2(self): """ Check tlog-play can playback session at 2x speed """ logfile = mklogfile(self.tempdir) shell = ssh_pexpect(self.user1, 'Secret123', 'localhost') mkrecording(shell, logfile, sleep=15) shell.close() shell = ssh_pexpect(self.user1, 'Secret123', 'localhost') time_start = time.time() opts = '-i {} --speed=2'.format(logfile) shell.sendline('tlog-play {}'.format(opts)) shell.expect('localhost') time_stop = time.time() assert time_stop - time_start < 9
def test_play_from_journal(self): """ Check tlog-play can playback session from journal """ shell = ssh_pexpect(self.user1, 'Secret123', 'localhost') mkrecording(shell, sleep=4) shell.close() entry = journal_find_last() message = entry['MESSAGE'] rec = ast.literal_eval(message)['rec'] tlog_rec = 'TLOG_REC={}'.format(rec) cmd = 'tlog-play -r journal -M {}'.format(tlog_rec) shell2 = ssh_pexpect(self.user1, 'Secret123', 'localhost') shell2.sendline(cmd) out = shell2.expect([pexpect.TIMEOUT, 'KNOWN BUGS'], timeout=10) assert out == 1
def test_play_from_journal(self): """ Check tlog-play can playback session from journal """ shell = ssh_pexpect(self.user1, 'Secret123', 'localhost') mkrecording(shell, sleep=4) shell.close() entry = journal_find_last() message = entry['MESSAGE'] rec = ast.literal_eval(message)['rec'] tlog_rec = 'TLOG_REC={}'.format(rec) cmd = 'tlog-play -r journal -M {}'.format(tlog_rec) shell2 = ssh_pexpect(self.user1, 'Secret123', 'localhost') shell2.sendline(cmd) out = shell2.expect([pexpect.TIMEOUT, 'localhost'], timeout=10) assert out == 1