depot/nixos/tests/taskchampion-sync-server.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

48 lines
1.5 KiB
Nix

import ./make-test-python.nix (
{ ... }:
{
name = "taskchampion-sync-server";
nodes = {
server = {
services.taskchampion-sync-server.enable = true;
services.taskchampion-sync-server.openFirewall = true;
};
client =
{ pkgs, ... }:
{
environment.systemPackages = [ pkgs.taskwarrior3 ];
};
};
testScript =
{ nodes, ... }:
let
cfg = nodes.server.services.taskchampion-sync-server;
port = builtins.toString cfg.port;
# Generated with uuidgen
uuid = "bf01376e-04a4-435a-9263-608567531af3";
password = "nixos-test";
in
''
# Explicitly start the VMs so that we don't accidentally start newServer
server.start()
client.start()
server.wait_for_unit("taskchampion-sync-server.service")
server.wait_for_open_port(${port})
# See man task-sync(5)
client.succeed("mkdir ~/.task")
client.succeed("touch ~/.taskrc")
client.succeed("echo sync.server.origin=http://server:${port} >> ~/.taskrc")
client.succeed("echo sync.server.client_id=${uuid} >> ~/.taskrc")
client.succeed("echo sync.encryption_secret=${password} >> ~/.taskrc")
client.succeed("task add hello world")
client.succeed("task sync")
# Useful for debugging
client.copy_from_vm("/root/.task", "client")
server.copy_from_vm("${cfg.dataDir}", "server")
'';
}
)