summary refs log tree commit diff
path: root/nixos/lib
diff options
context:
space:
mode:
authorPatrick Hilhorst <git@hilhorst.be>2021-06-02 14:19:08 +0200
committerPatrick Hilhorst <git@hilhorst.be>2021-06-02 14:20:04 +0200
commit5a589b5ba8941d734e9c3aebbf2be2f50d7c32a5 (patch)
tree601c11f9898769915c5efffef1186d5c0124d3a5 /nixos/lib
parentbffd12a4c7d15ac3fbed965e222e9b5e86c72021 (diff)
downloadnixpkgs-5a589b5ba8941d734e9c3aebbf2be2f50d7c32a5.tar
nixpkgs-5a589b5ba8941d734e9c3aebbf2be2f50d7c32a5.tar.gz
nixpkgs-5a589b5ba8941d734e9c3aebbf2be2f50d7c32a5.tar.bz2
nixpkgs-5a589b5ba8941d734e9c3aebbf2be2f50d7c32a5.tar.lz
nixpkgs-5a589b5ba8941d734e9c3aebbf2be2f50d7c32a5.tar.xz
nixpkgs-5a589b5ba8941d734e9c3aebbf2be2f50d7c32a5.tar.zst
nixpkgs-5a589b5ba8941d734e9c3aebbf2be2f50d7c32a5.zip
nixos/tests/test-driver: add shell_interact
Diffstat (limited to 'nixos/lib')
-rw-r--r--nixos/lib/test-driver/test-driver.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/nixos/lib/test-driver/test-driver.py b/nixos/lib/test-driver/test-driver.py
index e216e566f28..90ae2e558ef 100644
--- a/nixos/lib/test-driver/test-driver.py
+++ b/nixos/lib/test-driver/test-driver.py
@@ -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 = ""