Merge pull request #73993 from flokli/nixos-test-port-wordpress

nixosTests.wordpress: port to python
This commit is contained in:
Robin Gloster 2019-11-24 18:41:04 +01:00 committed by GitHub
commit 2d49ee8727
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 13 deletions

View file

@ -4524,6 +4524,12 @@
githubId = 117842;
name = "Henri Bourcereau";
};
mmilata = {
email = "martin@martinmilata.cz";
github = "mmilata";
gitHubId = 85857;
name = "Martin Milata";
};
mmlb = {
email = "me.mmlb@mmlb.me";
github = "mmlb";

View file

@ -1,9 +1,13 @@
import ./make-test.nix ({ pkgs, ... }:
import ./make-test-python.nix ({ pkgs, ... }:
{
name = "wordpress";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ grahamc ]; # under duress!
maintainers = [
flokli
grahamc # under duress!
mmilata
];
};
machine =
@ -23,19 +27,31 @@ import ./make-test.nix ({ pkgs, ... }:
};
testScript = ''
startAll;
import re
$machine->waitForUnit("httpd");
$machine->waitForUnit("phpfpm-wordpress-site1.local");
$machine->waitForUnit("phpfpm-wordpress-site2.local");
start_all()
$machine->succeed("curl -L site1.local | grep 'Welcome to the famous'");
$machine->succeed("curl -L site2.local | grep 'Welcome to the famous'");
machine.wait_for_unit("httpd")
$machine->succeed("systemctl --no-pager show wordpress-init-site1.local.service | grep 'ExecStart=.*status=0'");
$machine->succeed("systemctl --no-pager show wordpress-init-site2.local.service | grep 'ExecStart=.*status=0'");
$machine->succeed("grep -E '^define.*NONCE_SALT.{64,};\$' /var/lib/wordpress/site1.local/secret-keys.php");
$machine->succeed("grep -E '^define.*NONCE_SALT.{64,};\$' /var/lib/wordpress/site2.local/secret-keys.php");
machine.wait_for_unit("phpfpm-wordpress-site1.local")
machine.wait_for_unit("phpfpm-wordpress-site2.local")
site_names = ["site1.local", "site2.local"]
with subtest("website returns welcome screen"):
for site_name in site_names:
assert "Welcome to the famous" in machine.succeed(f"curl -L {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("secret keys are set"):
re.compile(r"^define.*NONCE_SALT.{64,};$")
for site_name in site_names:
assert r.match(
machine.succeed(f"cat /var/lib/wordpress/{site_name}/secret-keys.php")
)
'';
})