@@ -1,9 +1,13 @@
1−import ./make-test.nix ({ pkgs, ... }:
1+import ./make-test-python.nix ({ pkgs, ... }:
22
33{
44 name = "wordpress";
55 meta = with pkgs.stdenv.lib.maintainers; {
6− maintainers = [ grahamc ]; # under duress!
6+ maintainers = [
7+ flokli
8+ grahamc # under duress!
9+ mmilata
10+ ];
711 };
812
913 machine =
@@ -23,19 +27,31 @@ import ./make-test.nix ({ pkgs, ... }:
2327 };
2428
2529 testScript = ''
26− startAll;
30+ import re
2731
28− $machine->waitForUnit("httpd");
29− $machine->waitForUnit("phpfpm-wordpress-site1.local");
30− $machine->waitForUnit("phpfpm-wordpress-site2.local");
32+ start_all()
3133
32− $machine->succeed("curl -L site1.local | grep 'Welcome to the famous'");
33− $machine->succeed("curl -L site2.local | grep 'Welcome to the famous'");
34+ machine.wait_for_unit("httpd")
3435
35− $machine->succeed("systemctl --no-pager show wordpress-init-site1.local.service | grep 'ExecStart=.*status=0'");
36− $machine->succeed("systemctl --no-pager show wordpress-init-site2.local.service | grep 'ExecStart=.*status=0'");
37− $machine->succeed("grep -E '^define.*NONCE_SALT.{64,};\$' /var/lib/wordpress/site1.local/secret-keys.php");
38− $machine->succeed("grep -E '^define.*NONCE_SALT.{64,};\$' /var/lib/wordpress/site2.local/secret-keys.php");
39− '';
36+ machine.wait_for_unit("phpfpm-wordpress-site1.local")
37+ machine.wait_for_unit("phpfpm-wordpress-site2.local")
38+
39+ site_names = ["site1.local", "site2.local"]
40+
41+ with subtest("website returns welcome screen"):
42+ for site_name in site_names:
43+ assert "Welcome to the famous" in machine.succeed(f"curl -L {site_name}")
4044
45+ with subtest("wordpress-init went through"):
46+ for site_name in site_names:
47+ info = machine.get_unit_info(f"wordpress-init-{site_name}")
48+ assert info.Result == "success"
49+
50+ with subtest("secret keys are set"):
51+ re.compile(r"^define.*NONCE_SALT.{64,};$")
52+ for site_name in site_names:
53+ assert r.match(
54+ machine.succeed(f"cat /var/lib/wordpress/{site_name}/secret-keys.php")
55+ )
56+ '';
4157})