From: Scott Worley Date: Mon, 27 Jul 2020 22:31:47 +0000 (-0700) Subject: verifyDeviceIDSet() helper X-Git-Url: http://git.scottworley.com/syncthing-autoregister/commitdiff_plain/0a262b7925af942e617dd75bc531ec9d96836608?hp=cefa20b6ac66bfe7793f6ded33a7eb9e2354379f verifyDeviceIDSet() helper --- diff --git a/tests/automatic-enrollment.nix b/tests/automatic-enrollment.nix index 4694048..8cbcdc4 100644 --- a/tests/automatic-enrollment.nix +++ b/tests/automatic-enrollment.nix @@ -40,6 +40,13 @@ import ({ pkgs, lib, ... }: machine.copy_from_host(config, "/etc/nixos/configuration.nix") + def verifyDeviceIDSet(machine, expectedDevice): + machine.succeed( + '(( "$(nix eval --raw -f "" config.services.syncthing.declarative.devices.%s.id | wc -c)" == 63 ))' + % expectedDevice + ) + + initialConfiguration = "${configuration}" configurationWithDeviceIDs = ( "${configurationWithDeviceIDs}" @@ -48,8 +55,6 @@ import ({ pkgs, lib, ... }: setConfig(a, initialConfiguration) a.wait_for_unit("syncthing-autoregister.service") setConfig(a, configurationWithDeviceIDs) - a.succeed( - '(( "$(nix eval --raw -f "" config.services.syncthing.declarative.devices.a.id | wc -c)" == 63 ))' - ) + verifyDeviceIDSet(a, "a") ''; })