summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Arnott <colin@urandom.co.uk>2023-01-05 02:38:22 +0000
committerColin Arnott <colin@urandom.co.uk>2023-01-05 10:29:14 +0000
commitc01ee1b20d72d3bd8ac3c6cff98208bb837d4b11 (patch)
tree2588d830c864f33cbd237cf5327217595f57de64
parentwordpress6_0: init at 6.0.3 (diff)
downloadnixpkgs-c01ee1b20d72d3bd8ac3c6cff98208bb837d4b11.tar.gz
nixosTests.wordpress: iterate over versions
As a follow up to f9d1f80045d3ae01741896127837eba9f1559603, we should add the ability to test explicit versions of the wordpress derivation. Since we are currently only supporting wordpress6_1 in unstable, this change is a noop. (cherry picked from commit de49ddabaea028aec44225424c1a3be8279e9162)
-rw-r--r--nixos/tests/wordpress.nix34
1 files changed, 23 insertions, 11 deletions
diff --git a/nixos/tests/wordpress.nix b/nixos/tests/wordpress.nix
index 416a20aa7fe8..5e0d524d35aa 100644
--- a/nixos/tests/wordpress.nix
+++ b/nixos/tests/wordpress.nix
@@ -1,6 +1,6 @@
-import ./make-test-python.nix ({ pkgs, ... }:
+import ./make-test-python.nix ({ lib, pkgs, ... }:
-{
+rec {
name = "wordpress";
meta = with pkgs.lib.maintainers; {
maintainers = [
@@ -10,17 +10,22 @@ import ./make-test-python.nix ({ pkgs, ... }:
];
};
- nodes = {
- wp_httpd = { ... }: {
+ nodes = lib.foldl (a: version: let
+ package = pkgs."wordpress${version}";
+ in a // {
+ "wp${version}_httpd" = _: {
services.httpd.adminAddr = "webmaster@site.local";
services.httpd.logPerVirtualHost = true;
+ services.wordpress.webserver = "httpd";
services.wordpress.sites = {
"site1.local" = {
database.tablePrefix = "site1_";
+ inherit package;
};
"site2.local" = {
database.tablePrefix = "site2_";
+ inherit package;
};
};
@@ -28,14 +33,16 @@ import ./make-test-python.nix ({ pkgs, ... }:
networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ];
};
- wp_nginx = { ... }: {
+ "wp${version}_nginx" = _: {
services.wordpress.webserver = "nginx";
services.wordpress.sites = {
"site1.local" = {
database.tablePrefix = "site1_";
+ inherit package;
};
"site2.local" = {
database.tablePrefix = "site2_";
+ inherit package;
};
};
@@ -43,34 +50,39 @@ import ./make-test-python.nix ({ pkgs, ... }:
networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ];
};
- wp_caddy = { ... }: {
+ "wp${version}_caddy" = _: {
services.wordpress.webserver = "caddy";
services.wordpress.sites = {
"site1.local" = {
database.tablePrefix = "site1_";
+ inherit package;
};
"site2.local" = {
database.tablePrefix = "site2_";
+ inherit package;
};
};
networking.firewall.allowedTCPPorts = [ 80 ];
networking.hosts."127.0.0.1" = [ "site1.local" "site2.local" ];
};
- };
+ }) {} [
+ "6_0"
+ "6_1"
+ ];
testScript = ''
import re
start_all()
- wp_httpd.wait_for_unit("httpd")
- wp_nginx.wait_for_unit("nginx")
- wp_caddy.wait_for_unit("caddy")
+ ${lib.concatStrings (lib.mapAttrsToList (name: value: ''
+ ${name}.wait_for_unit("${(value null).services.wordpress.webserver}")
+ '') nodes)}
site_names = ["site1.local", "site2.local"]
- for machine in (wp_httpd, wp_nginx, wp_caddy):
+ for machine in (${lib.concatStringsSep ", " (builtins.attrNames nodes)}):
for site_name in site_names:
machine.wait_for_unit(f"phpfpm-wordpress-{site_name}")