nixos/tests/tor: a minimal test
For now check that the default client config boots. Ideas for the future: - Expand on control via netcat - Configure a circuit of nodes exercise various configs (e.g., check that a client node can access a hidden www service). Needs setting up authoritative directory servers &c.
This commit is contained in:
parent
0456edc275
commit
b9c953eb19
|
@ -398,6 +398,7 @@ in rec {
|
||||||
tests.switchTest = callTest tests/switch-test.nix {};
|
tests.switchTest = callTest tests/switch-test.nix {};
|
||||||
tests.taskserver = callTest tests/taskserver.nix {};
|
tests.taskserver = callTest tests/taskserver.nix {};
|
||||||
tests.tomcat = callTest tests/tomcat.nix {};
|
tests.tomcat = callTest tests/tomcat.nix {};
|
||||||
|
tests.tor = callTest tests/tor.nix {};
|
||||||
tests.transmission = callTest tests/transmission.nix {};
|
tests.transmission = callTest tests/transmission.nix {};
|
||||||
tests.udisks2 = callTest tests/udisks2.nix {};
|
tests.udisks2 = callTest tests/udisks2.nix {};
|
||||||
tests.vault = callTest tests/vault.nix {};
|
tests.vault = callTest tests/vault.nix {};
|
||||||
|
|
28
nixos/tests/tor.nix
Normal file
28
nixos/tests/tor.nix
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import ./make-test.nix ({ lib, ... }: with lib;
|
||||||
|
|
||||||
|
rec {
|
||||||
|
name = "tor";
|
||||||
|
meta.maintainers = with maintainers; [ joachifm ];
|
||||||
|
|
||||||
|
common =
|
||||||
|
{ config, ... }:
|
||||||
|
{ boot.kernelParams = [ "audit=0" "apparmor=0" "quiet" ];
|
||||||
|
networking.firewall.enable = false;
|
||||||
|
networking.useDHCP = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
nodes.client =
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
{ imports = [ common ];
|
||||||
|
environment.systemPackages = with pkgs; [ netcat ];
|
||||||
|
services.tor.enable = true;
|
||||||
|
services.tor.client.enable = true;
|
||||||
|
services.tor.controlPort = 9051;
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
$client->waitForUnit("tor.service");
|
||||||
|
$client->waitForOpenPort(9051);
|
||||||
|
$client->succeed("echo GETINFO version | nc 127.0.0.1 9051") =~ /514 Authentication required./ or die;
|
||||||
|
'';
|
||||||
|
})
|
Loading…
Reference in a new issue