]> git.scottworley.com Git - syncthing-autoregister/blob - tests/automatic-enrollment.nix
cac1b28ba83956bea3ea77f67fbe355ea4b81411
[syncthing-autoregister] / tests / automatic-enrollment.nix
1 import <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 })