git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #73993 from flokli/nixos-test-port-wordpress

nixosTests.wordpress: port to python

commit2d49ee8727920dcc7c863e75a8f37dc531ac7033 authorRobin Gloster <mail@glob.in> dateSun 24 Nov 2019, 18:41 (7 years ago) parentcaca39e069364f
2 files changed+35−13
maintainers/maintainer-list.nix+6 nixos/tests/wordpress.nix+29−13
maintainers/maintainer-list.nix+6
@@ -4524,6 +4524,12 @@
45244524 githubId = 117842;
45254525 name = "Henri Bourcereau";
45264526 };
4527+ mmilata = {
4528+ email = "martin@martinmilata.cz";
4529+ github = "mmilata";
4530+ gitHubId = 85857;
4531+ name = "Martin Milata";
4532+ };
45274533 mmlb = {
45284534 email = "me.mmlb@mmlb.me";
45294535 github = "mmlb";
nixos/tests/wordpress.nix+29−13
@@ -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})