]> git.scottworley.com Git - syncthing-autoregister/blame_incremental - tests/automatic-enrollment.nix
Syncthing device-id autoregistration
[syncthing-autoregister] / tests / automatic-enrollment.nix
... / ...
CommitLineData
1import <nixpkgs/nixos/tests/make-test-python.nix> ({ pkgs, lib, ... }:
2 let
3 configuration = pkgs.writeText "configuration.nix" ''
4 { pkgs, ... }: {
5 imports = [
6 ${../.}/modules/syncthing-autoregister.nix
7 <nixos/nixos/modules/installer/cd-dvd/channel.nix>
8 ];
9 services.syncthing = {
10 enable = true;
11 openDefaultPorts = true;
12 };
13 environment.systemPackages = with pkgs; [ nix ];
14 }
15 '';
16 in {
17
18 name = "syncthing";
19
20 machine = "${configuration}";
21
22 testScript = ''
23 machine.copy_from_host(
24 "${configuration}",
25 "/etc/nixos/configuration.nix",
26 )
27 machine.wait_for_unit("syncthing-autoregister.service")
28 machine.succeed(
29 '(( "$(nix eval --raw -f /tmp/syncthing-auto-register-test-device-ids.nix services.syncthing.declarative.devices.machine.id | wc -c)" == 63 ))'
30 )
31 '';
32 })