nixosTests.taskchampion-sync-server: init

This commit is contained in:
Doron Behar 2024-06-10 20:15:18 +03:00
parent ecf4caea3f
commit 2c40948c73
3 changed files with 52 additions and 0 deletions

View File

@ -993,6 +993,7 @@ in {
tandoor-recipes-script-name = handleTest ./tandoor-recipes-script-name.nix {};
tang = handleTest ./tang.nix {};
taskserver = handleTest ./taskserver.nix {};
taskchampion-sync-server = handleTest ./taskchampion-sync-server.nix {};
tayga = handleTest ./tayga.nix {};
technitium-dns-server = handleTest ./technitium-dns-server.nix {};
teeworlds = handleTest ./teeworlds.nix {};

View File

@ -0,0 +1,48 @@
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")
'';
}
)

View File

@ -8,6 +8,7 @@
fetchFromGitHub,
cmake,
libuuid,
nixosTests,
python3,
xdg-utils,
installShellFiles,
@ -75,6 +76,8 @@ stdenv.mkDerivation rec {
ln -s $out/share/vim-plugins/task $out/share/nvim/site
'';
passthru.tests.nixos = nixosTests.taskchampion-sync-server;
meta = {
changelog = "https://github.com/GothenburgBitFactory/taskwarrior/blob/${src.rev}/ChangeLog";
description = "Highly flexible command-line tool to manage TODO lists";