]> git.scottworley.com Git - syncthing-autoregister/commitdiff
verifyDeviceIDSet() helper
authorScott Worley <scottworley@scottworley.com>
Mon, 27 Jul 2020 22:31:47 +0000 (15:31 -0700)
committerScott Worley <scottworley@scottworley.com>
Mon, 27 Jul 2020 22:31:47 +0000 (15:31 -0700)
tests/automatic-enrollment.nix

index 46940488a952c7d87319dc737ef5fdf720ba8759..8cbcdc446b5743b57dcc2458e000651a1e0576f9 100644 (file)
@@ -40,6 +40,13 @@ import <nixpkgs/nixos/tests/make-test-python.nix> ({ pkgs, lib, ... }:
           machine.copy_from_host(config, "/etc/nixos/configuration.nix")
 
 
           machine.copy_from_host(config, "/etc/nixos/configuration.nix")
 
 
+      def verifyDeviceIDSet(machine, expectedDevice):
+          machine.succeed(
+              '(( "$(nix eval --raw -f "<nixos/nixos>" config.services.syncthing.declarative.devices.%s.id | wc -c)" == 63 ))'
+              % expectedDevice
+          )
+
+
       initialConfiguration = "${configuration}"
       configurationWithDeviceIDs = (
           "${configurationWithDeviceIDs}"
       initialConfiguration = "${configuration}"
       configurationWithDeviceIDs = (
           "${configurationWithDeviceIDs}"
@@ -48,8 +55,6 @@ import <nixpkgs/nixos/tests/make-test-python.nix> ({ pkgs, lib, ... }:
       setConfig(a, initialConfiguration)
       a.wait_for_unit("syncthing-autoregister.service")
       setConfig(a, configurationWithDeviceIDs)
       setConfig(a, initialConfiguration)
       a.wait_for_unit("syncthing-autoregister.service")
       setConfig(a, configurationWithDeviceIDs)
-      a.succeed(
-          '(( "$(nix eval --raw -f "<nixos/nixos>" config.services.syncthing.declarative.devices.a.id | wc -c)" == 63 ))'
-      )
+      verifyDeviceIDSet(a, "a")
     '';
   })
     '';
   })