mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-18 07:29:23 +03:00
nixos/tests: add unit-php test
This commit is contained in:
parent
dc0260f7da
commit
ca2145bdfc
3 changed files with 51 additions and 1 deletions
|
@ -321,6 +321,7 @@ in
|
||||||
trickster = handleTest ./trickster.nix {};
|
trickster = handleTest ./trickster.nix {};
|
||||||
tuptime = handleTest ./tuptime.nix {};
|
tuptime = handleTest ./tuptime.nix {};
|
||||||
udisks2 = handleTest ./udisks2.nix {};
|
udisks2 = handleTest ./udisks2.nix {};
|
||||||
|
unit-php = handleTest ./web-servers/unit-php.nix {};
|
||||||
upnp = handleTest ./upnp.nix {};
|
upnp = handleTest ./upnp.nix {};
|
||||||
uwsgi = handleTest ./uwsgi.nix {};
|
uwsgi = handleTest ./uwsgi.nix {};
|
||||||
vault = handleTest ./vault.nix {};
|
vault = handleTest ./vault.nix {};
|
||||||
|
|
47
nixos/tests/web-servers/unit-php.nix
Normal file
47
nixos/tests/web-servers/unit-php.nix
Normal file
|
@ -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
|
, withPython2 ? false, python2
|
||||||
, withPython3 ? true, python3, ncurses
|
, withPython3 ? true, python3, ncurses
|
||||||
, withPHP72 ? false, php72
|
, 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"}
|
${optionalString withRuby_2_7 "./configure ruby --module=ruby27 --ruby=${ruby_2_7}/bin/ruby"}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru.tests.unit-php = nixosTests.unit-php;
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Dynamic web and application server, designed to run applications in multiple languages.";
|
description = "Dynamic web and application server, designed to run applications in multiple languages.";
|
||||||
homepage = "https://unit.nginx.org/";
|
homepage = "https://unit.nginx.org/";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue