test: add tests for new service

This commit is contained in:
Łukasz Niemier 2020-04-28 19:06:45 +02:00
parent b30a04c00c
commit 43b7a6901b
No known key found for this signature in database
GPG key ID: C775391C950A6AEE
4 changed files with 29 additions and 2 deletions

View file

@ -38,6 +38,7 @@
./services/autossh.nix
./services/buildkite-agent.nix
./services/chunkwm.nix
./services/dnsmasq.nix
./services/emacs.nix
./services/khd
./services/kwm

View file

@ -23,7 +23,7 @@ in
};
services.dnsmasq.bind = mkOption {
type = types.string;
type = types.str;
default = "127.0.0.1";
description = "This option specifies the interface on which DNSmasq will listen.";
};

View file

@ -114,13 +114,14 @@ let
tests.services-buildkite-agent = makeTest ./tests/services-buildkite-agent.nix;
tests.services-nix-daemon = makeTest ./tests/services-nix-daemon.nix;
tests.sockets-nix-daemon = makeTest ./tests/sockets-nix-daemon.nix;
tests.services-dnsmasq = makeTest ./tests/services-dnsmasq.nix;
tests.services-nix-gc = makeTest ./tests/services-nix-gc.nix;
tests.services-ofborg = makeTest ./tests/services-ofborg.nix;
tests.services-offlineimap = makeTest ./tests/services-offlineimap.nix;
tests.services-privoxy = makeTest ./tests/services-privoxy.nix;
tests.services-skhd = makeTest ./tests/services-skhd.nix;
tests.services-synapse-bt = makeTest ./tests/services-synapse-bt.nix;
tests.services-synergy = makeTest ./tests/services-synergy.nix;
tests.services-privoxy = makeTest ./tests/services-privoxy.nix;
tests.system-defaults-write = makeTest ./tests/system-defaults-write.nix;
tests.system-environment = makeTest ./tests/system-environment.nix;
tests.system-keyboard-mapping = makeTest ./tests/system-keyboard-mapping.nix;

View file

@ -0,0 +1,25 @@
{ config, lib, pkgs, ... }:
with lib;
let
dnsmasq = pkgs.runCommand "dnsmasq-0.0.0" {} "mkdir $out";
in
{
services.dnsmasq.enable = true;
services.dnsmasq.package = dnsmasq;
services.dnsmasq.addresses = {
localhost = "127.0.0.1";
};
test = ''
echo >&2 "checking dnsmasq service in /Library/LaunchDaemons"
grep "org.nixos.dnsmasq" ${config.out}/Library/LaunchDaemons/org.nixos.dnsmasq.plist
grep "${dnsmasq}/bin/dnsmasq" ${config.out}/Library/LaunchDaemons/org.nixos.dnsmasq.plist
grep -F -- "--address=/localhost/127.0.0.1" ${config.out}/Library/LaunchDaemons/org.nixos.dnsmasq.plist
echo >&2 "checking resolver config"
grep -F "nameserver 127.0.0.1.53" ${config.out}/etc/resolver/localhost
'';
}