nixos/chrony: add simple test

This commit is contained in:
Franz Pletz 2023-08-10 02:02:33 +02:00
parent c13c1412bf
commit 50e7a02e67
No known key found for this signature in database
GPG Key ID: 846FDED7792617B4
3 changed files with 35 additions and 0 deletions

View File

@ -167,6 +167,7 @@ in {
cgit = handleTest ./cgit.nix {};
charliecloud = handleTest ./charliecloud.nix {};
chromium = (handleTestOn ["aarch64-linux" "x86_64-linux"] ./chromium.nix {}).stable or {};
chrony = handleTestOn ["aarch64-linux" "x86_64-linux"] ./chrony.nix {};
chrony-ptp = handleTestOn ["aarch64-linux" "x86_64-linux"] ./chrony-ptp.nix {};
cinnamon = handleTest ./cinnamon.nix {};
cjdns = handleTest ./cjdns.nix {};

31
nixos/tests/chrony.nix Normal file
View File

@ -0,0 +1,31 @@
import ./make-test-python.nix ({ lib, ... }:
{
name = "chrony";
meta = {
maintainers = with lib.maintainers; [ fpletz ];
};
nodes = {
default = {
services.chrony.enable = true;
};
graphene-hardened = {
services.chrony.enable = true;
services.chrony.enableMemoryLocking = true;
environment.memoryAllocator.provider = "graphene-hardened";
# dhcpcd privsep is incompatible with graphene-hardened
networking.useNetworkd = true;
};
};
testScript = {nodes, ...} : let
graphene-hardened = nodes.graphene-hardened.system.build.toplevel;
in ''
default.start()
default.wait_for_unit('multi-user.target')
default.succeed('systemctl is-active chronyd.service')
default.succeed('${graphene-hardened}/bin/switch-to-configuration test')
default.succeed('systemctl is-active chronyd.service')
'';
})

View File

@ -1,6 +1,7 @@
{ lib, stdenv, fetchurl, pkg-config
, gnutls, libedit, nspr, nss, readline, texinfo
, libcap, libseccomp, pps-tools
, nixosTests
}:
stdenv.mkDerivation rec {
@ -36,6 +37,8 @@ stdenv.mkDerivation rec {
hardeningEnable = [ "pie" ];
passthru.tests = { inherit (nixosTests) chrony chrony-ptp; };
meta = with lib; {
description = "Sets your computer's clock from time servers on the Net";
homepage = "https://chrony.tuxfamily.org/";