vuls: init at 0.27.0 (#348530)
[NixPkgs.git] / nixos / tests / taskchampion-sync-server.nix
blob42dfb0cbeca3036eb703fa2edee05bdbc23ec84c
1 import ./make-test-python.nix (
2   { ... }:
3   {
4     name = "taskchampion-sync-server";
6     nodes = {
7       server = {
8         services.taskchampion-sync-server.enable = true;
9         services.taskchampion-sync-server.openFirewall = true;
10       };
11       client =
12         { pkgs, ... }:
13         {
14           environment.systemPackages = [ pkgs.taskwarrior3 ];
15         };
16     };
17     testScript =
18       { nodes, ... }:
19       let
20         cfg = nodes.server.services.taskchampion-sync-server;
21         port = builtins.toString cfg.port;
22         # Generated with uuidgen
23         uuid = "bf01376e-04a4-435a-9263-608567531af3";
24         password = "nixos-test";
25       in
26       ''
27         # Explicitly start the VMs so that we don't accidentally start newServer
28         server.start()
29         client.start()
31         server.wait_for_unit("taskchampion-sync-server.service")
32         server.wait_for_open_port(${port})
34         # See man task-sync(5)
35         client.succeed("mkdir ~/.task")
36         client.succeed("touch ~/.taskrc")
37         client.succeed("echo sync.server.origin=http://server:${port} >> ~/.taskrc")
38         client.succeed("echo sync.server.client_id=${uuid} >> ~/.taskrc")
39         client.succeed("echo sync.encryption_secret=${password} >> ~/.taskrc")
40         client.succeed("task add hello world")
41         client.succeed("task sync")
43         # Useful for debugging
44         client.copy_from_vm("/root/.task", "client")
45         server.copy_from_vm("${cfg.dataDir}", "server")
46       '';
47   }