diff options
author | Izorkin <izorkin@elven.pw> | 2020-04-16 23:08:00 +0300 |
---|---|---|
committer | Izorkin <izorkin@elven.pw> | 2020-05-06 13:21:59 +0300 |
commit | ca2145bdfc83382ba7ec83a275734040a2a7fddc (patch) | |
tree | b677f3b13ff5a4e3c115dc31ddb26fa4e38c3c4e | |
parent | dc0260f7dabf55814b1ca3c37a40ace237ad1fde (diff) | |
download | nixlib-ca2145bdfc83382ba7ec83a275734040a2a7fddc.tar nixlib-ca2145bdfc83382ba7ec83a275734040a2a7fddc.tar.gz nixlib-ca2145bdfc83382ba7ec83a275734040a2a7fddc.tar.bz2 nixlib-ca2145bdfc83382ba7ec83a275734040a2a7fddc.tar.lz nixlib-ca2145bdfc83382ba7ec83a275734040a2a7fddc.tar.xz nixlib-ca2145bdfc83382ba7ec83a275734040a2a7fddc.tar.zst nixlib-ca2145bdfc83382ba7ec83a275734040a2a7fddc.zip |
nixos/tests: add unit-php test
-rw-r--r-- | nixos/tests/all-tests.nix | 1 | ||||
-rw-r--r-- | nixos/tests/web-servers/unit-php.nix | 47 | ||||
-rw-r--r-- | pkgs/servers/http/unit/default.nix | 4 |
3 files changed, 51 insertions, 1 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 46f552b26a46..d1b1acc292d0 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -321,6 +321,7 @@ in trickster = handleTest ./trickster.nix {}; tuptime = handleTest ./tuptime.nix {}; udisks2 = handleTest ./udisks2.nix {}; + unit-php = handleTest ./web-servers/unit-php.nix {}; upnp = handleTest ./upnp.nix {}; uwsgi = handleTest ./uwsgi.nix {}; vault = handleTest ./vault.nix {}; diff --git a/nixos/tests/web-servers/unit-php.nix b/nixos/tests/web-servers/unit-php.nix new file mode 100644 index 000000000000..c6327a1f825d --- /dev/null +++ b/nixos/tests/web-servers/unit-php.nix @@ -0,0 +1,47 @@ +import ../make-test-python.nix ({pkgs, ...}: + let + testdir = pkgs.writeTextDir "www/info.php" "<?php phpinfo();"; + +in { + name = "unit-php-test"; + meta.maintainers = with pkgs.stdenv.lib.maintainers; [ izorkin ]; + + machine = { config, lib, pkgs, ... }: { + services.unit = { + enable = true; + config = '' + { + "listeners": { + "*:9074": { + "application": "php_74" + } + }, + "applications": { + "php_74": { + "type": "php 7.4", + "processes": 1, + "user": "testuser", + "group": "testgroup", + "root": "${testdir}/www", + "index": "info.php" + } + } + } + ''; + }; + users = { + users.testuser = { + isNormalUser = false; + uid = 1074; + group = "testgroup"; + }; + groups.testgroup = { + gid= 1074; + }; + }; + }; + testScript = '' + machine.wait_for_unit("unit.service") + assert "PHP Version ${pkgs.php74.version}" in machine.succeed("curl -vvv -s http://127.0.0.1:9074/") + ''; +}) diff --git a/pkgs/servers/http/unit/default.nix b/pkgs/servers/http/unit/default.nix index 407882f176e6..c161566d329f 100644 --- a/pkgs/servers/http/unit/default.nix +++ b/pkgs/servers/http/unit/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, which +{ stdenv, fetchFromGitHub, nixosTests, which , withPython2 ? false, python2 , withPython3 ? true, python3, ncurses , withPHP72 ? false, php72 @@ -81,6 +81,8 @@ in stdenv.mkDerivation rec { ${optionalString withRuby_2_7 "./configure ruby --module=ruby27 --ruby=${ruby_2_7}/bin/ruby"} ''; + passthru.tests.unit-php = nixosTests.unit-php; + meta = { description = "Dynamic web and application server, designed to run applications in multiple languages."; homepage = "https://unit.nginx.org/"; |