nixos-wiki-infra/checks/test.nix

39 lines
1.3 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`
wiki = { self, pkgs, config, ... }: {
imports = [
self.nixosModules.nixos-wiki
];
2023-12-27 15:18:56 +01:00
networking.extraHosts = ''
127.0.0.1 nixos-wiki.example.com
'';
2023-11-19 09:23:50 +01:00
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;
};
};
};
# 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")
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
'';
}