nixosTests.dnscrypt-proxy2: handleTest -> runTest

This commit is contained in:
Sizhe Zhao 2025-06-07 20:58:45 +08:00
parent 5d3ba0f9a5
commit 9880867c45
No known key found for this signature in database
GPG Key ID: ED1807251A7DA08F
2 changed files with 34 additions and 38 deletions

View File

@ -408,7 +408,7 @@ in
dhparams = runTest ./dhparams.nix; dhparams = runTest ./dhparams.nix;
disable-installer-tools = runTest ./disable-installer-tools.nix; disable-installer-tools = runTest ./disable-installer-tools.nix;
discourse = runTest ./discourse.nix; discourse = runTest ./discourse.nix;
dnscrypt-proxy2 = handleTestOn [ "x86_64-linux" ] ./dnscrypt-proxy2.nix { }; dnscrypt-proxy2 = runTestOn [ "x86_64-linux" ] ./dnscrypt-proxy2.nix;
dnsdist = import ./dnsdist.nix { inherit pkgs runTest; }; dnsdist = import ./dnsdist.nix { inherit pkgs runTest; };
doas = runTest ./doas.nix; doas = runTest ./doas.nix;
docker = runTestOn [ "aarch64-linux" "x86_64-linux" ] ./docker.nix; docker = runTestOn [ "aarch64-linux" "x86_64-linux" ] ./docker.nix;

View File

@ -1,42 +1,38 @@
import ./make-test-python.nix ( { lib, ... }:
{ pkgs, ... }: let
let localProxyPort = 43;
localProxyPort = 43; in
in {
{ name = "dnscrypt-proxy2";
name = "dnscrypt-proxy2"; meta.maintainers = with lib.maintainers; [ joachifm ];
meta = with pkgs.lib.maintainers; {
maintainers = [ joachifm ];
};
nodes = { nodes = {
# A client running the recommended setup: DNSCrypt proxy as a forwarder # A client running the recommended setup: DNSCrypt proxy as a forwarder
# for a caching DNS client. # for a caching DNS client.
client = client =
{ ... }: { ... }:
{ {
security.apparmor.enable = true; security.apparmor.enable = true;
services.dnscrypt-proxy2.enable = true; services.dnscrypt-proxy2.enable = true;
services.dnscrypt-proxy2.settings = { services.dnscrypt-proxy2.settings = {
listen_addresses = [ "127.0.0.1:${toString localProxyPort}" ]; listen_addresses = [ "127.0.0.1:${toString localProxyPort}" ];
sources.public-resolvers = { sources.public-resolvers = {
urls = [ "https://download.dnscrypt.info/resolvers-list/v2/public-resolvers.md" ]; urls = [ "https://download.dnscrypt.info/resolvers-list/v2/public-resolvers.md" ];
cache_file = "public-resolvers.md"; cache_file = "public-resolvers.md";
minisign_key = "RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3"; minisign_key = "RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3";
refresh_delay = 72; refresh_delay = 72;
};
}; };
services.dnsmasq.enable = true;
services.dnsmasq.settings.server = [ "127.0.0.1#${toString localProxyPort}" ];
}; };
};
testScript = '' services.dnsmasq.enable = true;
client.wait_for_unit("dnsmasq") services.dnsmasq.settings.server = [ "127.0.0.1#${toString localProxyPort}" ];
client.wait_for_unit("dnscrypt-proxy2") };
client.wait_until_succeeds("ss --numeric --udp --listening | grep -q ${toString localProxyPort}") };
'';
} testScript = ''
) client.wait_for_unit("dnsmasq")
client.wait_for_unit("dnscrypt-proxy2")
client.wait_until_succeeds("ss --numeric --udp --listening | grep -q ${toString localProxyPort}")
'';
}