From ae31454d41ae6d706f80a9deb3cf5c4d5c89c334 Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 5 May 2023 21:02:11 +0200 Subject: [PATCH] nixosTests.tinyproxy: init --- nixos/tests/all-tests.nix | 1 + nixos/tests/tinyproxy.nix | 20 ++++++++++++++++++++ pkgs/tools/networking/tinyproxy/default.nix | 2 ++ 3 files changed, 23 insertions(+) create mode 100644 nixos/tests/tinyproxy.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 5ceb39d0be51..17fa3ac1373c 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -734,6 +734,7 @@ in { timezone = handleTest ./timezone.nix {}; tinc = handleTest ./tinc {}; tinydns = handleTest ./tinydns.nix {}; + tinyproxy = handleTest ./tinyproxy.nix {}; tinywl = handleTest ./tinywl.nix {}; tmate-ssh-server = handleTest ./tmate-ssh-server.nix { }; tomcat = handleTest ./tomcat.nix {}; diff --git a/nixos/tests/tinyproxy.nix b/nixos/tests/tinyproxy.nix new file mode 100644 index 000000000000..b8448d4c23b6 --- /dev/null +++ b/nixos/tests/tinyproxy.nix @@ -0,0 +1,20 @@ +import ./make-test-python.nix ({ pkgs, ... }: { + name = "tinyproxy"; + + nodes.machine = { config, pkgs, ... }: { + services.tinyproxy = { + enable = true; + settings = { + Listen = "127.0.0.1"; + Port = 8080; + }; + }; + }; + + testScript = '' + machine.wait_for_unit("tinyproxy.service") + machine.wait_for_open_port(8080) + + machine.succeed('curl -s http://localhost:8080 |grep -i tinyproxy') + ''; +}) diff --git a/pkgs/tools/networking/tinyproxy/default.nix b/pkgs/tools/networking/tinyproxy/default.nix index 12c8a0d0447e..8778b90b2b02 100644 --- a/pkgs/tools/networking/tinyproxy/default.nix +++ b/pkgs/tools/networking/tinyproxy/default.nix @@ -4,6 +4,7 @@ , fetchpatch , autoreconfHook , perl +, nixosTests , withDebug ? false }: @@ -30,6 +31,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ autoreconfHook perl ]; configureFlags = lib.optionals withDebug [ "--enable-debug" ]; # Enable debugging support code and methods. + passthru.tests = { inherit (nixosTests) tinyproxy; }; meta = with lib; { homepage = "https://tinyproxy.github.io/";