diff options
Diffstat (limited to 'nixos/tests/wordpress.nix')
-rw-r--r-- | nixos/tests/wordpress.nix | 68 |
1 files changed, 44 insertions, 24 deletions
diff --git a/nixos/tests/wordpress.nix b/nixos/tests/wordpress.nix index b7449859f7e..45c58b5b65c 100644 --- a/nixos/tests/wordpress.nix +++ b/nixos/tests/wordpress.nix @@ -2,7 +2,7 @@ import ./make-test-python.nix ({ pkgs, ... }: { name = "wordpress"; - meta = with pkgs.stdenv.lib.maintainers; { + meta = with pkgs.lib.maintainers; { maintainers = [ flokli grahamc # under duress! @@ -10,48 +10,68 @@ import ./make-test-python.nix ({ pkgs, ... }: ]; }; - machine = - { ... }: - { services.httpd.adminAddr = "webmaster@site.local"; + nodes = { + wp_httpd = { ... }: { + services.httpd.adminAddr = "webmaster@site.local"; services.httpd.logPerVirtualHost = true; - services.wordpress."site1.local" = { - database.tablePrefix = "site1_"; + services.wordpress = { + # Test support for old interface + "site1.local" = { + database.tablePrefix = "site1_"; + }; + sites = { + "site2.local" = { + database.tablePrefix = "site2_"; + }; + }; }; - services.wordpress."site2.local" = { - database.tablePrefix = "site2_"; + networking.firewall.allowedTCPPorts = [ 80 ]; + networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ]; + }; + + wp_nginx = { ... }: { + services.wordpress.webserver = "nginx"; + services.wordpress.sites = { + "site1.local" = { + database.tablePrefix = "site1_"; + }; + "site2.local" = { + database.tablePrefix = "site2_"; + }; }; + networking.firewall.allowedTCPPorts = [ 80 ]; networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ]; }; + }; testScript = '' import re start_all() - machine.wait_for_unit("httpd") - - machine.wait_for_unit("phpfpm-wordpress-site1.local") - machine.wait_for_unit("phpfpm-wordpress-site2.local") + wp_httpd.wait_for_unit("httpd") + wp_nginx.wait_for_unit("nginx") site_names = ["site1.local", "site2.local"] - with subtest("website returns welcome screen"): + for machine in (wp_httpd, wp_nginx): for site_name in site_names: - assert "Welcome to the famous" in machine.succeed(f"curl -L {site_name}") + machine.wait_for_unit(f"phpfpm-wordpress-{site_name}") - with subtest("wordpress-init went through"): - for site_name in site_names: - info = machine.get_unit_info(f"wordpress-init-{site_name}") - assert info["Result"] == "success" + with subtest("website returns welcome screen"): + assert "Welcome to the famous" in machine.succeed(f"curl -L {site_name}") - with subtest("secret keys are set"): - pattern = re.compile(r"^define.*NONCE_SALT.{64,};$", re.MULTILINE) - for site_name in site_names: - assert pattern.search( - machine.succeed(f"cat /var/lib/wordpress/{site_name}/secret-keys.php") - ) + with subtest("wordpress-init went through"): + info = machine.get_unit_info(f"wordpress-init-{site_name}") + assert info["Result"] == "success" + + with subtest("secret keys are set"): + pattern = re.compile(r"^define.*NONCE_SALT.{64,};$", re.MULTILINE) + assert pattern.search( + machine.succeed(f"cat /var/lib/wordpress/{site_name}/secret-keys.php") + ) ''; }) |