Add a flake check `phonebox-global-sync` that exercises phonebox-sync.py: yggdrasil address derivation (fixed vector plus cross-check against the yggdrasil binary), record verification (foreign address, bad or forged signature, malformed tags, number format), collision tie-breaking, and the files written for the dialplan including stale entry removal.
40 lines
917 B
Nix
40 lines
917 B
Nix
{
|
|
inputs,
|
|
self,
|
|
...
|
|
}:
|
|
let
|
|
module = ./default.nix;
|
|
in
|
|
{
|
|
clan.modules = {
|
|
phonebox-global = module;
|
|
};
|
|
perSystem =
|
|
{ pkgs, ... }:
|
|
{
|
|
clan.nixosTests.service-phonebox-global = {
|
|
imports = [ ./tests/vm/default.nix ];
|
|
_module.args = { inherit self inputs; };
|
|
|
|
clan.modules."@clan/phonebox-global" = module;
|
|
};
|
|
|
|
# Unit tests for the directory sync logic (record verification,
|
|
# address derivation, collision handling, file output).
|
|
checks.phonebox-global-sync =
|
|
pkgs.runCommand "phonebox-global-sync-test"
|
|
{
|
|
nativeBuildInputs = [
|
|
(pkgs.python3.withPackages (ps: [ ps.cryptography ]))
|
|
pkgs.yggdrasil
|
|
];
|
|
PHONEBOX_SYNC = ./phonebox-sync.py;
|
|
}
|
|
''
|
|
python3 ${./tests/sync/test_sync.py} -v
|
|
touch $out
|
|
'';
|
|
};
|
|
}
|