From 0a262b7925af942e617dd75bc531ec9d96836608 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Mon, 27 Jul 2020 15:31:47 -0700 Subject: [PATCH] verifyDeviceIDSet() helper --- tests/automatic-enrollment.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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") ''; }) -- 2.44.1