summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorAndrew Dunham <andrew@du.nham.ca>2019-11-25 00:36:37 -0800
committerAndrew Dunham <andrew@du.nham.ca>2019-11-25 00:36:37 -0800
commit7398211601c6120b47b22f72cd1b6b7e8e7e41ad (patch)
tree719dcf906fec42cf4c7c2ee88521752ee2e527fc /nixos
parent6e38def213c9d3fc4f9cb7062c6ee580ef07f913 (diff)
downloadnixpkgs-7398211601c6120b47b22f72cd1b6b7e8e7e41ad.tar
nixpkgs-7398211601c6120b47b22f72cd1b6b7e8e7e41ad.tar.gz
nixpkgs-7398211601c6120b47b22f72cd1b6b7e8e7e41ad.tar.bz2
nixpkgs-7398211601c6120b47b22f72cd1b6b7e8e7e41ad.tar.lz
nixpkgs-7398211601c6120b47b22f72cd1b6b7e8e7e41ad.tar.xz
nixpkgs-7398211601c6120b47b22f72cd1b6b7e8e7e41ad.tar.zst
nixpkgs-7398211601c6120b47b22f72cd1b6b7e8e7e41ad.zip
nixosTests.syncthing*: port to python
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/syncthing-init.nix12
-rw-r--r--nixos/tests/syncthing-relay.nix14
2 files changed, 14 insertions, 12 deletions
diff --git a/nixos/tests/syncthing-init.nix b/nixos/tests/syncthing-init.nix
index 0de76b688bd..9c8e0a3d087 100644
--- a/nixos/tests/syncthing-init.nix
+++ b/nixos/tests/syncthing-init.nix
@@ -1,4 +1,4 @@
-import ./make-test.nix ({ lib, pkgs, ... }: let
+import ./make-test-python.nix ({ lib, pkgs, ... }: let
 
   testId = "7CFNTQM-IMTJBHJ-3UWRDIU-ZGQJFR6-VCXZ3NB-XUH3KZO-N52ITXR-LAIYUAU";
 
@@ -22,13 +22,11 @@ in {
   };
 
   testScript = ''
-    my $config;
-
-    $machine->waitForUnit("syncthing-init.service");
-    $config = $machine->succeed("cat /var/lib/syncthing/.config/syncthing/config.xml");
+    machine.wait_for_unit("syncthing-init.service")
+    config = machine.succeed("cat /var/lib/syncthing/.config/syncthing/config.xml")
    
-    $config =~ /${testId}/ or die;
-    $config =~ /testFolder/ or die;
+    assert "testFolder" in config
+    assert "${testId}" in config
   '';
 })
 
diff --git a/nixos/tests/syncthing-relay.nix b/nixos/tests/syncthing-relay.nix
index f1ceb499333..cd72ef1cbe1 100644
--- a/nixos/tests/syncthing-relay.nix
+++ b/nixos/tests/syncthing-relay.nix
@@ -1,4 +1,4 @@
-import ./make-test.nix ({ lib, pkgs, ... }: {
+import ./make-test-python.nix ({ lib, pkgs, ... }: {
   name = "syncthing-relay";
   meta.maintainers = with pkgs.stdenv.lib.maintainers; [ delroth ];
 
@@ -14,9 +14,13 @@ import ./make-test.nix ({ lib, pkgs, ... }: {
   };
 
   testScript = ''
-    $machine->waitForUnit("syncthing-relay.service");
-    $machine->waitForOpenPort(12345);
-    $machine->waitForOpenPort(12346);
-    $machine->succeed("curl http://localhost:12346/status | jq -r '.options.\"provided-by\"'") =~ /nixos-test/ or die;
+    machine.wait_for_unit("syncthing-relay.service")
+    machine.wait_for_open_port(12345)
+    machine.wait_for_open_port(12346)
+
+    out = machine.succeed(
+        "curl -sS http://localhost:12346/status | jq -r '.options.\"provided-by\"'"
+    )
+    assert "nixos-test" in out
   '';
 })