nixos/tests/dnscrypt-wrapper: fix flakyness

rnhmjoj 0bd475c2 c7c288fb

+9 -7
+1 -1
nixos/tests/all-tests.nix
··· 214 214 disable-installer-tools = handleTest ./disable-installer-tools.nix {}; 215 215 discourse = handleTest ./discourse.nix {}; 216 216 dnscrypt-proxy2 = handleTestOn ["x86_64-linux"] ./dnscrypt-proxy2.nix {}; 217 - dnscrypt-wrapper = handleTestOn ["x86_64-linux"] ./dnscrypt-wrapper {}; 217 + dnscrypt-wrapper = runTestOn ["x86_64-linux"] ./dnscrypt-wrapper; 218 218 dnsdist = handleTest ./dnsdist.nix {}; 219 219 doas = handleTest ./doas.nix {}; 220 220 docker = handleTestOn ["aarch64-linux" "x86_64-linux"] ./docker.nix {};
+8 -6
nixos/tests/dnscrypt-wrapper/default.nix
··· 1 - import ../make-test-python.nix ({ pkgs, ... }: { 1 + { lib, pkgs, ... }: 2 + 3 + { 2 4 name = "dnscrypt-wrapper"; 3 5 meta = with pkgs.lib.maintainers; { 4 6 maintainers = [ rnhmjoj ]; ··· 50 52 server.wait_for_unit("dnscrypt-wrapper") 51 53 server.wait_for_file("/var/lib/dnscrypt-wrapper/2.dnscrypt-cert.server.key") 52 54 server.wait_for_file("/var/lib/dnscrypt-wrapper/2.dnscrypt-cert.server.crt") 55 + almost_expiration = server.succeed("date --date '4days 23 hours 56min'").strip() 53 56 54 57 with subtest("The client can connect to the server"): 55 58 server.wait_for_unit("tinydns") 56 59 client.wait_for_unit("dnscrypt-proxy2") 57 - assert "1.2.3.4" in client.succeed( 60 + assert "1.2.3.4" in client.wait_until_succeeds( 58 61 "host it.works" 59 62 ), "The IP address of 'it.works' does not match 1.2.3.4" 60 63 61 64 with subtest("The server rotates the ephemeral keys"): 62 65 # advance time by a little less than 5 days 63 - server.succeed("date -s \"$(date --date '4 days 6 hours')\"") 64 - client.succeed("date -s \"$(date --date '4 days 6 hours')\"") 66 + server.succeed(f"date -s '{almost_expiration}'") 67 + client.succeed(f"date -s '{almost_expiration}'") 65 68 server.wait_for_file("/var/lib/dnscrypt-wrapper/oldkeys") 66 69 67 70 with subtest("The client can still connect to the server"): 68 71 server.wait_for_unit("dnscrypt-wrapper") 69 72 client.succeed("host it.works") 70 73 ''; 71 - }) 72 - 74 + }