about summary refs log tree commit diff
path: root/nixos/tests/novacomd.nix
diff options
context:
space:
mode:
authorChristian Kampka <christian@kampka.net>2019-12-15 19:32:34 +0100
committerChristian Kampka <christian@kampka.net>2019-12-15 19:35:33 +0100
commit1f3f9fd3a2fad9b43af73ed3e62ae2cc203c76da (patch)
tree542507f62bd07685698ef75f1ed242dc9c4ef17e /nixos/tests/novacomd.nix
parent065770607e6f2751d8638947f86241882008970b (diff)
nixosTests.novacomd: Port tests to python
Diffstat (limited to 'nixos/tests/novacomd.nix')
-rw-r--r--nixos/tests/novacomd.nix32
1 files changed, 13 insertions, 19 deletions
diff --git a/nixos/tests/novacomd.nix b/nixos/tests/novacomd.nix
index 4eb60c0feb5ce..940210dee2355 100644
--- a/nixos/tests/novacomd.nix
+++ b/nixos/tests/novacomd.nix
@@ -1,4 +1,4 @@
-import ./make-test.nix ({ pkgs, ...} : {
+import ./make-test-python.nix ({ pkgs, ...} : {
   name = "novacomd";
   meta = with pkgs.stdenv.lib.maintainers; {
     maintainers = [ dtzWill ];
@@ -9,26 +9,20 @@ import ./make-test.nix ({ pkgs, ...} : {
   };
 
   testScript = ''
-    $machine->waitForUnit("multi-user.target");
+    machine.wait_for_unit("novacomd.service")
 
-    # multi-user.target wants novacomd.service, but let's make sure
-    $machine->waitForUnit("novacomd.service");
+    with subtest("Make sure the daemon is really listening"):
+        machine.wait_for_open_port(6968)
+        machine.succeed("novacom -l")
 
-    # Check status and try connecting with novacom
-    $machine->succeed("systemctl status novacomd.service >&2");
-    # to prevent non-deterministic failure,
-    # make sure the daemon is really listening
-    $machine->waitForOpenPort(6968);
-    $machine->succeed("novacom -l");
+    with subtest("Stop the daemon, double-check novacom fails if daemon isn't working"):
+        machine.stop_job("novacomd")
+        machine.fail("novacom -l")
 
-    # Stop the daemon, double-check novacom fails if daemon isn't working
-    $machine->stopJob("novacomd");
-    $machine->fail("novacom -l");
-
-    # And back again for good measure
-    $machine->startJob("novacomd");
-    # make sure the daemon is really listening
-    $machine->waitForOpenPort(6968);
-    $machine->succeed("novacom -l");
+    with subtest("Make sure the daemon starts back up again"):
+        machine.start_job("novacomd")
+        # make sure the daemon is really listening
+        machine.wait_for_open_port(6968)
+        machine.succeed("novacom -l")
   '';
 })