about summary refs log tree commit diff
path: root/nixos/tests/uptermd.nix
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2022-05-15 09:52:39 +0200
committerJörg Thalheim <joerg@thalheim.io>2022-05-15 09:57:52 +0200
commit14e2c1e4fb972145bb2d8ed5f60a435fc3319276 (patch)
tree0410e8e3c0369f4bb502c783346f9fda1daaa773 /nixos/tests/uptermd.nix
parenteefafb54ef3fbc0f2bf146e5fdefe75bdc154a69 (diff)
nixos/upterm: fix race condition in test
Diffstat (limited to 'nixos/tests/uptermd.nix')
-rw-r--r--nixos/tests/uptermd.nix7
1 files changed, 5 insertions, 2 deletions
diff --git a/nixos/tests/uptermd.nix b/nixos/tests/uptermd.nix
index b2ff9a1e0d9cf..d504ef0641916 100644
--- a/nixos/tests/uptermd.nix
+++ b/nixos/tests/uptermd.nix
@@ -30,11 +30,14 @@ in
     server.wait_for_unit("uptermd.service")
     server.wait_for_unit("network-online.target")
 
+    # wait for upterm port to be reachable
+    client1.wait_until_succeeds("nc -z -v server 1337")
+
     # Add SSH hostkeys from the server to both clients
     # uptermd needs an '@cert-authority entry so we need to modify the known_hosts file
-    client1.execute("sleep 3; mkdir -p ~/.ssh && ssh -o StrictHostKeyChecking=no -p 1337 server ls")
+    client1.execute("mkdir -p ~/.ssh && ssh -o StrictHostKeyChecking=no -p 1337 server ls")
     client1.execute("echo @cert-authority $(cat ~/.ssh/known_hosts) > ~/.ssh/known_hosts")
-    client2.execute("sleep 3; mkdir -p ~/.ssh && ssh -o StrictHostKeyChecking=no -p 1337 server ls")
+    client2.execute("mkdir -p ~/.ssh && ssh -o StrictHostKeyChecking=no -p 1337 server ls")
     client2.execute("echo @cert-authority $(cat ~/.ssh/known_hosts) > ~/.ssh/known_hosts")
 
     client1.wait_for_unit("multi-user.target")