depot/third_party/nixpkgs/nixos/tests/ntpd-rs.nix
Default email 23b612e36f Project import generated by Copybara.
GitOrigin-RevId: ae5c332cbb5827f6b1f02572496b141021de335f
2024-01-25 23:12:00 +09:00

51 lines
1.2 KiB
Nix

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()
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')
'';
})