summary refs log tree commit diff
path: root/nixos/tests/initrd-network-ssh
diff options
context:
space:
mode:
authorWilliButz <wbutz@cyberfnord.de>2019-11-06 16:48:07 +0100
committerWilliButz <wbutz@cyberfnord.de>2019-11-07 11:30:02 +0100
commit9a7101c999ae94574497498ec48b9e000b85e107 (patch)
treec21f25b64e924d1dbe722b05e74d3ab486b81ce5 /nixos/tests/initrd-network-ssh
parent336bffae6dbcd7abbdd2518cc1303485da2140c7 (diff)
downloadnixpkgs-9a7101c999ae94574497498ec48b9e000b85e107.tar
nixpkgs-9a7101c999ae94574497498ec48b9e000b85e107.tar.gz
nixpkgs-9a7101c999ae94574497498ec48b9e000b85e107.tar.bz2
nixpkgs-9a7101c999ae94574497498ec48b9e000b85e107.tar.lz
nixpkgs-9a7101c999ae94574497498ec48b9e000b85e107.tar.xz
nixpkgs-9a7101c999ae94574497498ec48b9e000b85e107.tar.zst
nixpkgs-9a7101c999ae94574497498ec48b9e000b85e107.zip
nixos/tests/initrd-ssh: port to python
Diffstat (limited to 'nixos/tests/initrd-network-ssh')
-rw-r--r--nixos/tests/initrd-network-ssh/default.nix38
1 files changed, 22 insertions, 16 deletions
diff --git a/nixos/tests/initrd-network-ssh/default.nix b/nixos/tests/initrd-network-ssh/default.nix
index 796c50c610e..73d9f938e22 100644
--- a/nixos/tests/initrd-network-ssh/default.nix
+++ b/nixos/tests/initrd-network-ssh/default.nix
@@ -1,4 +1,4 @@
-import ../make-test.nix ({ lib, ... }:
+import ../make-test-python.nix ({ lib, ... }:
 
 {
   name = "initrd-network-ssh";
@@ -35,25 +35,31 @@ import ../make-test.nix ({ lib, ... }:
     client =
       { config, ... }:
       {
-        environment.etc.knownHosts = {
-          text = concatStrings [
-            "server,"
-            "${toString (head (splitString " " (
-              toString (elemAt (splitString "\n" config.networking.extraHosts) 2)
-            )))} "
-            "${readFile ./dropbear.pub}"
-          ];
+        environment.etc = {
+          knownHosts = {
+            text = concatStrings [
+              "server,"
+              "${toString (head (splitString " " (
+                toString (elemAt (splitString "\n" config.networking.extraHosts) 2)
+              )))} "
+              "${readFile ./dropbear.pub}"
+            ];
+          };
+          sshKey = {
+            source = ./openssh.priv; # dont use this anywhere else
+            mode = "0600";
+          };
         };
       };
   };
 
   testScript = ''
-    startAll;
-    $client->waitForUnit("network.target");
-    $client->copyFileFromHost("${./openssh.priv}","/etc/sshKey");
-    $client->succeed("chmod 0600 /etc/sshKey");
-    $client->waitUntilSucceeds("ping -c 1 server");
-    $client->succeed("ssh -i /etc/sshKey -o UserKnownHostsFile=/etc/knownHosts server 'touch /fnord'");
-    $client->shutdown;
+    start_all()
+    client.wait_for_unit("network.target")
+    client.wait_until_succeeds("ping -c 1 server")
+    client.succeed(
+        "ssh -i /etc/sshKey -o UserKnownHostsFile=/etc/knownHosts server 'touch /fnord'"
+    )
+    client.shutdown()
   '';
 })