summary refs log blame commit diff
path: root/nixos/tests/syncthing-init.nix
blob: 8b60ad7faf09088b35aefb295d5edfe5efb38dc6 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
                                                      




                                                                             
                                                             



                          

                            
        




                                        



                 

                                                                                   
 

                                 
                              

     
import ./make-test-python.nix ({ lib, pkgs, ... }: let

  testId = "7CFNTQM-IMTJBHJ-3UWRDIU-ZGQJFR6-VCXZ3NB-XUH3KZO-N52ITXR-LAIYUAU";

in {
  name = "syncthing-init";
  meta.maintainers = with pkgs.lib.maintainers; [ lassulus ];

  machine = {
    services.syncthing = {
      enable = true;
      devices.testDevice = {
        id = testId;
      };
      folders.testFolder = {
        path = "/tmp/test";
        devices = [ "testDevice" ];
      };
      extraOptions.gui.user = "guiUser";
    };
  };

  testScript = ''
    machine.wait_for_unit("syncthing-init.service")
    config = machine.succeed("cat /var/lib/syncthing/.config/syncthing/config.xml")

    assert "testFolder" in config
    assert "${testId}" in config
    assert "guiUser" in config
  '';
})