git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #13780 from joachifm/dnscrypt-vmtest-for-upstream

nixos/tests: implement dnscrypt-proxy test

commit0f6e93d9d04762da2385b2bb4837139077f91183 authorjoachifm <joachifm@users.noreply.github.com> dateFri 11 Mar 2016, 11:22 (11 years ago) parentda739e21949218
2 files changed+33
nixos/release.nix+1 nixos/tests/dnscrypt-proxy.nix+32
nixos/release.nix+1
@@ -240,6 +240,7 @@ in rec {
240240 tests.containers = callTest tests/containers.nix {};
241241 tests.docker = hydraJob (import tests/docker.nix { system = "x86_64-linux"; });
242242 tests.dockerRegistry = hydraJob (import tests/docker-registry.nix { system = "x86_64-linux"; });
243+ tests.dnscrypt-proxy = callTest tests/dnscrypt-proxy.nix { system = "x86_64-linux"; };
243244 tests.etcd = hydraJob (import tests/etcd.nix { system = "x86_64-linux"; });
244245 tests.ec2-nixops = hydraJob (import tests/ec2.nix { system = "x86_64-linux"; }).boot-ec2-nixops;
245246 tests.ec2-config = hydraJob (import tests/ec2.nix { system = "x86_64-linux"; }).boot-ec2-config;
nixos/tests/dnscrypt-proxy.nixnew file+32
@@ -0,0 +1,32 @@
1+import ./make-test.nix ({ pkgs, ... }: {
2+ name = "dnscrypt-proxy";
3+ meta = with pkgs.stdenv.lib.maintainers; {
4+ maintainers = [ joachifm ];
5+ };
6+
7+ nodes = {
8+ # A client running the recommended setup: DNSCrypt proxy as a forwarder
9+ # for a caching DNS client.
10+ client =
11+ { config, pkgs, ... }:
12+ let localProxyPort = 43; in
13+ {
14+ security.apparmor.enable = true;
15+
16+ services.dnscrypt-proxy.enable = true;
17+ services.dnscrypt-proxy.localPort = localProxyPort;
18+
19+ services.dnsmasq.enable = true;
20+ services.dnsmasq.servers = [ "127.0.0.1#${toString localProxyPort}" ];
21+ };
22+ };
23+
24+ testScript = ''
25+ $client->start;
26+ $client->waitForUnit("multi-user.target");
27+
28+ # The daemon is socket activated; sending a single ping should activate it.
29+ $client->execute("${pkgs.iputils}/bin/ping -c1 example.com");
30+ $client->succeed("systemctl is-active dnscrypt-proxy.service");
31+ '';
32+})