nixos/mediawiki: also test fcgi socket

This commit is contained in:
Jörg Thalheim 2023-04-28 23:05:55 +02:00
parent d309952a5d
commit 077e950f7a
2 changed files with 20 additions and 1 deletions

View File

@ -190,6 +190,16 @@ in
description = lib.mdDoc "Which MediaWiki package to use.";
};
finalPackage = mkOption {
type = types.package;
readOnly = true;
default = pkg;
defaultText = literalExpression "pkg";
description = lib.mdDoc ''
The final package used by the module. This is the package that will have extensions and skins installed.
'';
};
name = mkOption {
type = types.str;
default = "MediaWiki";

View File

@ -60,9 +60,18 @@ in
nodes.machine = {
services.mediawiki.webserver = "none";
};
testScript = ''
testScript = { nodes, ... }: ''
start_all()
machine.wait_for_unit("phpfpm-mediawiki.service")
env = (
"SCRIPT_NAME=/index.php",
"SCRIPT_FILENAME=${nodes.machine.services.mediawiki.finalPackage}/share/mediawiki/index.php",
"REMOTE_ADDR=127.0.0.1",
'QUERY_STRING=title=Main_Page',
"REQUEST_METHOD=GET",
);
page = machine.succeed(f"{' '.join(env)} ${pkgs.fcgi}/bin/cgi-fcgi -bind -connect ${nodes.machine.services.phpfpm.pools.mediawiki.socket}")
assert "MediaWiki has been installed" in page, f"no 'MediaWiki has been installed' in:\n{page}"
'';
};
}