nixos/tests: add unit-php test

wip/yesman
Izorkin 4 years ago
parent dc0260f7da
commit ca2145bdfc
  1. 1
      nixos/tests/all-tests.nix
  2. 47
      nixos/tests/web-servers/unit-php.nix
  3. 4
      pkgs/servers/http/unit/default.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 {};

@ -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/")
'';
})

@ -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/";

Loading…
Cancel
Save