nixos-wiki-infra/checks/test.nix

47 lines
1.4 KiB
Nix
Raw Normal View History

2023-11-19 09:23:50 +01:00
(import ./lib.nix) {
name = "nixos-wiki";
nodes = {
# `self` here is set by using specialArgs in `lib.nix`
2024-09-28 16:15:00 +02:00
wiki =
{
self,
pkgs,
config,
...
}:
{
imports = [
self.nixosModules.nixos-wiki
];
networking.extraHosts = ''
127.0.0.1 nixos-wiki.example.com
'';
security.acme.defaults.email = "admin@example.com";
services.nixos-wiki = {
hostname = "nixos-wiki.example.com";
adminPasswordFile = pkgs.writeText "adminPasswordFile" "Creation-Fabric-Untrimmed3";
githubClientId = "Iv1.95ed182c83df1d22";
githubClientSecretFile = pkgs.writeText "githubClientSecretFile" "secret";
emergencyContact = "nixos-wiki@thalheim.io";
passwordSender = "nixos-wiki@thalheim.io";
noReplyAddress = "nixos-wiki-no-reply@thalheim.io";
};
services.nginx.virtualHosts.${config.services.mediawiki.nginx.hostName} = {
enableACME = false;
forceSSL = false;
};
2023-11-19 09:23:50 +01:00
};
};
# This is the test code that will check if our service is running correctly:
testScript = ''
start_all()
machine.wait_for_unit("phpfpm-mediawiki.service")
machine.wait_for_unit("nginx.service")
2024-07-08 10:04:33 +02:00
machine.wait_for_unit("mediawiki-init.service")
2023-11-19 09:23:50 +01:00
2023-12-27 15:18:56 +01:00
page = machine.succeed("curl -vL http://nixos-wiki.example.com/")
2023-11-19 09:23:50 +01:00
assert "MediaWiki has been installed" in page
'';
}