about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMarijan <marijan.petricevic@hotmail.de>2019-11-06 22:41:03 +0100
committerMarijan <marijan.petricevic@hotmail.de>2019-11-06 22:43:37 +0100
commit9915a8ca45ff0867739d2cefe0be622d8c817368 (patch)
tree56c171f3df1fc78c62eae934e33d3b8568a201a5 /nixos
parent01f79dfc9e2e132479ff053ed79ead82731327b7 (diff)
downloadnixlib-9915a8ca45ff0867739d2cefe0be622d8c817368.tar
nixlib-9915a8ca45ff0867739d2cefe0be622d8c817368.tar.gz
nixlib-9915a8ca45ff0867739d2cefe0be622d8c817368.tar.bz2
nixlib-9915a8ca45ff0867739d2cefe0be622d8c817368.tar.lz
nixlib-9915a8ca45ff0867739d2cefe0be622d8c817368.tar.xz
nixlib-9915a8ca45ff0867739d2cefe0be622d8c817368.tar.zst
nixlib-9915a8ca45ff0867739d2cefe0be622d8c817368.zip
nixos/tests: implemented python test-driver version of forwardPort
Diffstat (limited to 'nixos')
-rw-r--r--nixos/lib/test-driver/test-driver.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/nixos/lib/test-driver/test-driver.py b/nixos/lib/test-driver/test-driver.py
index bc2c719295c5..3992250221db 100644
--- a/nixos/lib/test-driver/test-driver.py
+++ b/nixos/lib/test-driver/test-driver.py
@@ -650,6 +650,14 @@ class Machine:
     def sleep(self, secs):
         time.sleep(secs)
 
+    def forward_port(self, host_port=8080, guest_port=80):
+        """Forward a TCP port on the host to a TCP port on the guest.
+        Useful during interactive testing.
+        """
+        self.send_monitor_command(
+            "hostfwd_add tcp::{}-:{}".format(host_port, guest_port)
+        )
+
     def block(self):
         """Make the machine unreachable by shutting down eth1 (the multicast
         interface used to talk to the other VMs).  We keep eth0 up so that