diff options
Diffstat (limited to 'nixos/tests/php/fpm.nix')
-rw-r--r-- | nixos/tests/php/fpm.nix | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/nixos/tests/php/fpm.nix b/nixos/tests/php/fpm.nix index 513abd94373..31a79bb4dbe 100644 --- a/nixos/tests/php/fpm.nix +++ b/nixos/tests/php/fpm.nix @@ -1,30 +1,35 @@ -import ../make-test-python.nix ({pkgs, lib, ...}: { - name = "php-fpm-nginx-test"; +import ../make-test-python.nix ({ pkgs, lib, php, ... }: { + name = "php-${php.version}-fpm-nginx-test"; meta.maintainers = lib.teams.php.members; machine = { config, lib, pkgs, ... }: { + environment.systemPackages = [ php ]; + services.nginx = { enable = true; - virtualHosts."phpfpm" = let - testdir = pkgs.writeTextDir "web/index.php" "<?php phpinfo();"; - in { - root = "${testdir}/web"; - locations."~ \.php$".extraConfig = '' - fastcgi_pass unix:${config.services.phpfpm.pools.foobar.socket}; - fastcgi_index index.php; - include ${pkgs.nginx}/conf/fastcgi_params; - include ${pkgs.nginx}/conf/fastcgi.conf; - ''; - locations."/" = { - tryFiles = "$uri $uri/ index.php"; - index = "index.php index.html index.htm"; + virtualHosts."phpfpm" = + let + testdir = pkgs.writeTextDir "web/index.php" "<?php phpinfo();"; + in + { + root = "${testdir}/web"; + locations."~ \\.php$".extraConfig = '' + fastcgi_pass unix:${config.services.phpfpm.pools.foobar.socket}; + fastcgi_index index.php; + include ${pkgs.nginx}/conf/fastcgi_params; + include ${pkgs.nginx}/conf/fastcgi.conf; + ''; + locations."/" = { + tryFiles = "$uri $uri/ index.php"; + index = "index.php index.html index.htm"; + }; }; - }; }; services.phpfpm.pools."foobar" = { user = "nginx"; + phpPackage = php; settings = { "listen.group" = "nginx"; "listen.mode" = "0600"; @@ -43,11 +48,12 @@ import ../make-test-python.nix ({pkgs, lib, ...}: { machine.wait_for_unit("phpfpm-foobar.service") # Check so we get an evaluated PHP back - response = machine.succeed("curl -vvv -s http://127.0.0.1:80/") - assert "PHP Version ${pkgs.php.version}" in response, "PHP version not detected" + response = machine.succeed("curl -fvvv -s http://127.0.0.1:80/") + assert "PHP Version ${php.version}" in response, "PHP version not detected" # Check so we have database and some other extensions loaded - for ext in ["json", "opcache", "pdo_mysql", "pdo_pgsql", "pdo_sqlite"]: + for ext in ["json", "opcache", "pdo_mysql", "pdo_pgsql", "pdo_sqlite", "apcu"]: assert ext in response, f"Missing {ext} extension" + machine.succeed(f'test -n "$(php -m | grep -i {ext})"') ''; }) |