manual: tests: Describe how to port-forward into test VMs

authored by

Niklas Hambüchen and committed by
Jörg Thalheim
dcceeb98 5d73d954

+16
+16
nixos/doc/manual/development/running-nixos-tests-interactively.section.md
··· 57 57 Once the connection is established, you can enter commands in the socat terminal 58 58 where socat is running. 59 59 60 + ## Port forwarding to NixOS test VMs {#sec-nixos-test-port-forwarding} 61 + 62 + If your test has only a single VM, you may use e.g. 63 + 64 + ```ShellSession 65 + $ QEMU_NET_OPTS="hostfwd=tcp:127.0.0.1:2222-127.0.0.1:22" ./result/bin/nixos-test-driver 66 + ``` 67 + 68 + to port-forward a port in the VM (here `22`) to the host machine (here port `2222`). 69 + 70 + This naturally does not work when multiple machines are involved, 71 + since a single port on the host cannot forward to multiple VMs. 72 + 73 + If the test defines multiple machines, you may opt to _temporarily_ set 74 + `virtualisation.forwardPorts` in the test definition for debugging. 75 + 60 76 ## Reuse VM state {#sec-nixos-test-reuse-vm-state} 61 77 62 78 You can re-use the VM states coming from a previous run by setting the