nixos/tests/test-driver: add shell_interact
This commit is contained in:
parent
bffd12a4c7
commit
5a589b5ba8
1 changed files with 10 additions and 0 deletions
|
@ -21,6 +21,7 @@ import shutil
|
|||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
import telnetlib
|
||||
import tempfile
|
||||
import time
|
||||
import traceback
|
||||
|
@ -455,6 +456,15 @@ class Machine:
|
|||
return (status_code, output)
|
||||
output += chunk
|
||||
|
||||
def shell_interact(self) -> None:
|
||||
"""Allows you to interact with the guest shell
|
||||
|
||||
Should only be used during testing, not in the production test."""
|
||||
self.connect()
|
||||
telnet = telnetlib.Telnet()
|
||||
telnet.sock = self.shell # type: ignore
|
||||
telnet.interact()
|
||||
|
||||
def succeed(self, *commands: str) -> str:
|
||||
"""Execute each command and check that it succeeds."""
|
||||
output = ""
|
||||
|
|
Loading…
Reference in a new issue