summary refs log tree commit diff
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2020-04-16 21:48:40 +0200
committerJan Tojnar <jtojnar@gmail.com>2020-04-17 14:40:12 +0200
commitaac9832b96cb9e79348b6fc48da7b308ad9b8838 (patch)
tree4af33312d0fc4c3a74993af1a2637884e45ea492
parentc214e63f2e0dd81a9c03bdcbb83dbe8ddfd7d980 (diff)
downloadnixpkgs-aac9832b96cb9e79348b6fc48da7b308ad9b8838.tar
nixpkgs-aac9832b96cb9e79348b6fc48da7b308ad9b8838.tar.gz
nixpkgs-aac9832b96cb9e79348b6fc48da7b308ad9b8838.tar.bz2
nixpkgs-aac9832b96cb9e79348b6fc48da7b308ad9b8838.tar.lz
nixpkgs-aac9832b96cb9e79348b6fc48da7b308ad9b8838.tar.xz
nixpkgs-aac9832b96cb9e79348b6fc48da7b308ad9b8838.tar.zst
nixpkgs-aac9832b96cb9e79348b6fc48da7b308ad9b8838.zip
nixosTests.php.httpd: init
-rw-r--r--nixos/release-combined.nix1
-rw-r--r--nixos/tests/php/default.nix1
-rw-r--r--nixos/tests/php/httpd.nix31
3 files changed, 33 insertions, 0 deletions
diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix
index 02f19610f8a..2a0a9113a86 100644
--- a/nixos/release-combined.nix
+++ b/nixos/release-combined.nix
@@ -117,6 +117,7 @@ in rec {
         (onFullSupported "nixos.tests.openssh")
         (onFullSupported "nixos.tests.pantheon")
         (onFullSupported "nixos.tests.php.fpm")
+        (onFullSupported "nixos.tests.php.httpd")
         (onFullSupported "nixos.tests.php.pcre")
         (onFullSupported "nixos.tests.plasma5")
         (onFullSupported "nixos.tests.predictable-interface-names.predictableNetworkd")
diff --git a/nixos/tests/php/default.nix b/nixos/tests/php/default.nix
index 9ab14f722d0..ee7a3b56a3e 100644
--- a/nixos/tests/php/default.nix
+++ b/nixos/tests/php/default.nix
@@ -3,5 +3,6 @@
   pkgs ? import ../../.. { inherit system config; }
 }: {
   fpm = import ./fpm.nix { inherit system pkgs; };
+  httpd = import ./httpd.nix { inherit system pkgs; };
   pcre = import ./pcre.nix { inherit system pkgs; };
 }
diff --git a/nixos/tests/php/httpd.nix b/nixos/tests/php/httpd.nix
new file mode 100644
index 00000000000..fc3ff986734
--- /dev/null
+++ b/nixos/tests/php/httpd.nix
@@ -0,0 +1,31 @@
+import ../make-test-python.nix ({pkgs, ...}: {
+  name = "php-httpd-test";
+  meta.maintainers = with pkgs.stdenv.lib.maintainers; [ etu ];
+
+  machine = { config, lib, pkgs, ... }: {
+    services.httpd = {
+      enable = true;
+      adminAddr = "admin@phpfpm";
+      virtualHosts."phpfpm" = let
+        testdir = pkgs.writeTextDir "web/index.php" "<?php phpinfo();";
+      in {
+        documentRoot = "${testdir}/web";
+        locations."/" = {
+          index = "index.php index.html";
+        };
+      };
+      enablePHP = true;
+    };
+  };
+  testScript = { ... }: ''
+    machine.wait_for_unit("httpd.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"
+
+    # Check so we have database and some other extensions loaded
+    for ext in ["json", "opcache", "pdo_mysql", "pdo_pgsql", "pdo_sqlite"]:
+        assert ext in response, f"Missing {ext} extension"
+  '';
+})