about summary refs log tree commit diff
path: root/nixpkgs/nixos/tests/tor.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/tests/tor.nix')
-rw-r--r--nixpkgs/nixos/tests/tor.nix23
1 files changed, 23 insertions, 0 deletions
diff --git a/nixpkgs/nixos/tests/tor.nix b/nixpkgs/nixos/tests/tor.nix
new file mode 100644
index 000000000000..b55fbf91232c
--- /dev/null
+++ b/nixpkgs/nixos/tests/tor.nix
@@ -0,0 +1,23 @@
+import ./make-test-python.nix ({ lib, ... }: {
+  name = "tor";
+  meta.maintainers = with lib.maintainers; [ joachifm ];
+
+  nodes.client = { pkgs, ... }: {
+    boot.kernelParams = [ "audit=0" "apparmor=0" "quiet" ];
+    networking.firewall.enable = false;
+    networking.useDHCP = false;
+
+    environment.systemPackages = [ pkgs.netcat ];
+    services.tor.enable = true;
+    services.tor.client.enable = true;
+    services.tor.settings.ControlPort = 9051;
+  };
+
+  testScript = ''
+    client.wait_for_unit("tor.service")
+    client.wait_for_open_port(9051)
+    assert "514 Authentication required." in client.succeed(
+        "echo GETINFO version | nc 127.0.0.1 9051"
+    )
+  '';
+})