1 import ./make-test-python.nix ({ lib, pkgs, ... }:
5 meta = with pkgs.lib.maintainers; {
8 grahamc # under duress!
13 nodes = lib.foldl (a: version: let
14 package = pkgs."wordpress_${version}";
16 "wp${version}_httpd" = _: {
17 services.httpd.adminAddr = "webmaster@site.local";
18 services.httpd.logPerVirtualHost = true;
20 services.wordpress.webserver = "httpd";
21 services.wordpress.sites = {
23 database.tablePrefix = "site1_";
27 database.tablePrefix = "site2_";
32 networking.firewall.allowedTCPPorts = [ 80 ];
33 networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ];
36 "wp${version}_nginx" = _: {
37 services.wordpress.webserver = "nginx";
38 services.wordpress.sites = {
40 database.tablePrefix = "site1_";
44 database.tablePrefix = "site2_";
49 networking.firewall.allowedTCPPorts = [ 80 ];
50 networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ];
53 "wp${version}_caddy" = _: {
54 services.wordpress.webserver = "caddy";
55 services.wordpress.sites = {
57 database.tablePrefix = "site1_";
61 database.tablePrefix = "site2_";
66 networking.firewall.allowedTCPPorts = [ 80 ];
67 networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ];
78 ${lib.concatStrings (lib.mapAttrsToList (name: value: ''
79 ${name}.wait_for_unit("${(value null).services.wordpress.webserver}")
82 site_names = ["site1.local", "site2.local"]
84 for machine in (${lib.concatStringsSep ", " (builtins.attrNames nodes)}):
85 for site_name in site_names:
86 machine.wait_for_unit(f"phpfpm-wordpress-{site_name}")
88 with subtest("website returns welcome screen"):
89 assert "Welcome to the famous" in machine.succeed(f"curl -L {site_name}")
91 with subtest("wordpress-init went through"):
92 info = machine.get_unit_info(f"wordpress-init-{site_name}")
93 assert info["Result"] == "success"
95 with subtest("secret keys are set"):
96 pattern = re.compile(r"^define.*NONCE_SALT.{64,};$", re.MULTILINE)
97 assert pattern.search(
98 machine.succeed(f"cat /var/lib/wordpress/{site_name}/secret-keys.php")