1 import <nixpkgs/nixos/tests/make-test-python.nix> ({ pkgs, lib, ... }:
3 configuration = pkgs.writeText "configuration.nix" ''
6 ${../.}/modules/syncthing-autoregister.nix
7 <nixos/nixos/modules/installer/cd-dvd/channel.nix>
11 openDefaultPorts = true;
14 path = "/tmp/syncthing-auto-register-test-device-ids.nix";
17 environment.systemPackages = with pkgs; [ nix ];
20 configurationWithDeviceIDs =
21 pkgs.writeText "configuration-with-device-ids.nix" ''
25 /tmp/syncthing-auto-register-test-device-ids.nix
34 a = "${configuration}";
35 b = "${configuration}";
39 def setConfig(machine, config):
40 machine.copy_from_host(config, "/etc/nixos/configuration.nix")
43 def verifyDeviceIDSet(machine, expectedDevice):
45 '(( "$(nix eval --raw -f "<nixos/nixos>" config.services.syncthing.declarative.devices.%s.id | wc -c)" == 63 ))'
50 initialConfiguration = "${configuration}"
51 configurationWithDeviceIDs = (
52 "${configurationWithDeviceIDs}"
55 setConfig(a, initialConfiguration)
56 a.wait_for_unit("syncthing-autoregister.service")
57 setConfig(a, configurationWithDeviceIDs)
58 verifyDeviceIDSet(a, "a")