nixpkgs/nixos/tests/ntpd-rs.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

52 lines
1.2 KiB
Nix
Raw Normal View History

2023-10-31 14:28:49 +00:00
import ./make-test-python.nix ({ lib, ... }:
{
name = "ntpd-rs";
meta = {
maintainers = with lib.maintainers; [ fpletz ];
};
nodes = {
client = {
services.ntpd-rs = {
enable = true;
metrics.enable = true;
useNetworkingTimeServers = false;
settings = {
source = [
{
mode = "server";
address = "server";
}
];
synchronization = {
minimum-agreeing-sources = 1;
};
};
};
};
server = {
networking.firewall.allowedUDPPorts = [ 123 ];
services.ntpd-rs = {
enable = true;
metrics.enable = true;
settings = {
server = [
{ listen = "[::]:123"; }
];
};
};
};
};
testScript = { nodes, ... }: ''
start_all()
2024-01-17 13:56:49 +00:00
for machine in (server, client):
machine.wait_for_unit('multi-user.target')
machine.succeed('systemctl is-active ntpd-rs.service')
machine.succeed('systemctl is-active ntpd-rs-metrics.service')
machine.succeed('curl http://localhost:9975/metrics | grep ntp_uptime_seconds')
2023-10-31 14:28:49 +00:00
'';
})