1 import ../make-test-python.nix ({ pkgs, ... }:
5 # nix shell .#rkvm --command "rkvm-certificate-gen --ip-addresses 10.0.0.1 cert.pem key.pem"
7 snakeoil-cert = ./cert.pem;
8 snakeoil-key = ./key.pem;
14 server = { pkgs, ... }: {
15 imports = [ ../common/user-account.nix ];
17 virtualisation.vlans = [ 1 ];
22 firewall.enable = false;
25 systemd.network.networks."01-eth1" = {
27 networkConfig.Address = "10.0.0.1/24";
30 services.getty.autologinUser = "alice";
32 services.rkvm.server = {
35 certificate = snakeoil-cert;
37 password = "snakeoil";
38 switch-keys = [ "left-alt" "right-alt" ];
43 client = { pkgs, ... }: {
44 imports = [ ../common/user-account.nix ];
46 virtualisation.vlans = [ 1 ];
51 firewall.enable = false;
54 systemd.network.networks."01-eth1" = {
56 networkConfig.Address = "10.0.0.2/24";
59 services.getty.autologinUser = "alice";
61 services.rkvm.client = {
64 server = "10.0.0.1:5258";
65 certificate = snakeoil-cert;
67 password = "snakeoil";
74 server.wait_for_unit("getty@tty1.service")
75 server.wait_until_succeeds("pgrep -f 'agetty.*tty1'")
76 server.wait_for_unit("rkvm-server")
77 server.wait_for_open_port(5258)
79 client.wait_for_unit("getty@tty1.service")
80 client.wait_until_succeeds("pgrep -f 'agetty.*tty1'")
81 client.wait_for_unit("rkvm-client")
86 server.send_key("alt-alt_r", delay=0.2)
87 server.send_chars("echo 'hello client' > /tmp/test.txt\n")
90 server.send_key("alt-alt_r", delay=0.2)
91 server.send_chars("echo 'hello server' > /tmp/test.txt\n")
95 client.systemctl("stop rkvm-client.service")
96 server.systemctl("stop rkvm-server.service")
98 server_file = server.succeed("cat /tmp/test.txt")
99 assert server_file.strip() == "hello server"
101 client_file = client.succeed("cat /tmp/test.txt")
102 assert client_file.strip() == "hello client"