diff options
author | Robin Gloster <mail@glob.in> | 2019-11-24 18:41:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-24 18:41:04 +0100 |
commit | 2d49ee8727920dcc7c863e75a8f37dc531ac7033 (patch) | |
tree | 7813741e4e867d4e5aadee257bc729e4e9f96fb4 /nixos | |
parent | caca39eb8e4202e911c277f4adad460b176b643a (diff) | |
parent | 069364f34897be82c193dcd3501ab99f4e46cdc0 (diff) | |
download | nixlib-2d49ee8727920dcc7c863e75a8f37dc531ac7033.tar nixlib-2d49ee8727920dcc7c863e75a8f37dc531ac7033.tar.gz nixlib-2d49ee8727920dcc7c863e75a8f37dc531ac7033.tar.bz2 nixlib-2d49ee8727920dcc7c863e75a8f37dc531ac7033.tar.lz nixlib-2d49ee8727920dcc7c863e75a8f37dc531ac7033.tar.xz nixlib-2d49ee8727920dcc7c863e75a8f37dc531ac7033.tar.zst nixlib-2d49ee8727920dcc7c863e75a8f37dc531ac7033.zip |
Merge pull request #73993 from flokli/nixos-test-port-wordpress
nixosTests.wordpress: port to python
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/tests/wordpress.nix | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/nixos/tests/wordpress.nix b/nixos/tests/wordpress.nix index c6acfa6c1f3d..64c533d70f42 100644 --- a/nixos/tests/wordpress.nix +++ b/nixos/tests/wordpress.nix @@ -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") + ) + ''; }) |