From 80f1294c2d073643352fba816691d816aad4ff44 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Mon, 27 Jul 2020 14:29:36 -0700 Subject: [PATCH] Test reads device ID out of system config --- tests/automatic-enrollment.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/automatic-enrollment.nix b/tests/automatic-enrollment.nix index 870e6ee..92c90b7 100644 --- a/tests/automatic-enrollment.nix +++ b/tests/automatic-enrollment.nix @@ -17,6 +17,14 @@ import ({ pkgs, lib, ... }: environment.systemPackages = with pkgs; [ nix ]; } ''; + configurationWithDeviceIDs = pkgs.writeText "configuration-with-device-ids.nix" '' + { + imports = [ + ${configuration} + /tmp/syncthing-auto-register-test-device-ids.nix + ]; + } + ''; in { name = "syncthing"; @@ -29,8 +37,12 @@ import ({ pkgs, lib, ... }: "/etc/nixos/configuration.nix", ) machine.wait_for_unit("syncthing-autoregister.service") + machine.copy_from_host( + "${configurationWithDeviceIDs}", + "/etc/nixos/configuration.nix", + ) machine.succeed( - '(( "$(nix eval --raw -f /tmp/syncthing-auto-register-test-device-ids.nix services.syncthing.declarative.devices.machine.id | wc -c)" == 63 ))' + '(( "$(nix eval --raw -f "" config.services.syncthing.declarative.devices.machine.id | wc -c)" == 63 ))' ) ''; }) -- 2.44.1