git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #74114 from andrew-d/andrew/syncthing-tests-python

nixosTests.syncthing*: port to python

commit71882102e35ee20910eb8f8f8544606a636dd572 authorworldofpeace <worldofpeace@protonmail.ch> dateMon 25 Nov 2019, 14:03 (7 years ago) parentb0fa7bc7398211
2 files changed+14−12
nixos/tests/syncthing-init.nix+5−7 nixos/tests/syncthing-relay.nix+9−5
nixos/tests/syncthing-init.nix+5−7
@@ -1,4 +1,4 @@
1−import ./make-test.nix ({ lib, pkgs, ... }: let
1+import ./make-test-python.nix ({ lib, pkgs, ... }: let
22
33 testId = "7CFNTQM-IMTJBHJ-3UWRDIU-ZGQJFR6-VCXZ3NB-XUH3KZO-N52ITXR-LAIYUAU";
44
@@ -22,13 +22,11 @@ in {
2222 };
2323
2424 testScript = ''
25− my $config;
26−
27− $machine->waitForUnit("syncthing-init.service");
28− $config = $machine->succeed("cat /var/lib/syncthing/.config/syncthing/config.xml");
25+ machine.wait_for_unit("syncthing-init.service")
26+ config = machine.succeed("cat /var/lib/syncthing/.config/syncthing/config.xml")
2927
30− $config =~ /${testId}/ or die;
31− $config =~ /testFolder/ or die;
28+ assert "testFolder" in config
29+ assert "${testId}" in config
3230 '';
3331})
3432
nixos/tests/syncthing-relay.nix+9−5
@@ -1,4 +1,4 @@
1−import ./make-test.nix ({ lib, pkgs, ... }: {
1+import ./make-test-python.nix ({ lib, pkgs, ... }: {
22 name = "syncthing-relay";
33 meta.maintainers = with pkgs.stdenv.lib.maintainers; [ delroth ];
44
@@ -14,9 +14,13 @@ import ./make-test.nix ({ lib, pkgs, ... }: {
1414 };
1515
1616 testScript = ''
17− $machine->waitForUnit("syncthing-relay.service");
18− $machine->waitForOpenPort(12345);
19− $machine->waitForOpenPort(12346);
20− $machine->succeed("curl http://localhost:12346/status | jq -r '.options.\"provided-by\"'") =~ /nixos-test/ or die;
17+ machine.wait_for_unit("syncthing-relay.service")
18+ machine.wait_for_open_port(12345)
19+ machine.wait_for_open_port(12346)
20+
21+ out = machine.succeed(
22+ "curl -sS http://localhost:12346/status | jq -r '.options.\"provided-by\"'"
23+ )
24+ assert "nixos-test" in out
2125 '';
2226})