1 import ./make-test-python.nix ({ pkgs, ... }:
5 meta = with pkgs.lib.maintainers; {
8 grahamc # under duress!
15 services.httpd.adminAddr = "webmaster@site.local";
16 services.httpd.logPerVirtualHost = true;
18 services.wordpress.sites = {
20 database.tablePrefix = "site1_";
23 database.tablePrefix = "site2_";
27 networking.firewall.allowedTCPPorts = [ 80 ];
28 networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ];
32 services.wordpress.webserver = "nginx";
33 services.wordpress.sites = {
35 database.tablePrefix = "site1_";
38 database.tablePrefix = "site2_";
42 networking.firewall.allowedTCPPorts = [ 80 ];
43 networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ];
47 services.wordpress.webserver = "caddy";
48 services.wordpress.sites = {
50 database.tablePrefix = "site1_";
53 database.tablePrefix = "site2_";
57 networking.firewall.allowedTCPPorts = [ 80 ];
58 networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ];
67 wp_httpd.wait_for_unit("httpd")
68 wp_nginx.wait_for_unit("nginx")
69 wp_caddy.wait_for_unit("caddy")
71 site_names = ["site1.local", "site2.local"]
73 for machine in (wp_httpd, wp_nginx, wp_caddy):
74 for site_name in site_names:
75 machine.wait_for_unit(f"phpfpm-wordpress-{site_name}")
77 with subtest("website returns welcome screen"):
78 assert "Welcome to the famous" in machine.succeed(f"curl -L {site_name}")
80 with subtest("wordpress-init went through"):
81 info = machine.get_unit_info(f"wordpress-init-{site_name}")
82 assert info["Result"] == "success"
84 with subtest("secret keys are set"):
85 pattern = re.compile(r"^define.*NONCE_SALT.{64,};$", re.MULTILINE)
86 assert pattern.search(
87 machine.succeed(f"cat /var/lib/wordpress/{site_name}/secret-keys.php")