Skip to content

Instantly share code, notes, and snippets.

@Kiwi
Last active December 1, 2019 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Kiwi/48e8160134ed08164923d32594dd3298 to your computer and use it in GitHub Desktop.
Save Kiwi/48e8160134ed08164923d32594dd3298 to your computer and use it in GitHub Desktop.
{ system ? builtins.currentSystem
, config ? {}
, pkgs ? import ../.. { inherit system config; }
}:
with import ../lib/testing-python.nix { inherit system pkgs; };
with pkgs.lib;
let
matomoTest = package:
makeTest {
nodes = {
matomo_stable = { config, pkgs, ... }: {
services.matomo = {
package = package;
enable = true;
nginx = {
forceSSL = false;
enableACME = false;
};
};
services.mysql = {
enable = true;
package = pkgs.mysql;
};
services.nginx.enable = true;
};
};
testScript = ''
start_all()
matomo_stable.wait_for_unit("mysql.service")
matomo_stable.wait_for_unit("phpfpm-matomo.service")
matomo_stable.wait_for_unit("nginx.service")
# without the grep the command does not produce valid utf-8 for some reason
with subtest("welcome screen loads"):
matomo_stable.succeed(
"curl -sSfL http://localhost/ | grep '<title>Matomo[^<]*Installation'"
)
'';
};
matomoBetaTest = package:
makeTest {
nodes = {
matomo_beta = { config, pkgs, ... }: {
services.matomo = {
package = package;
enable = true;
nginx = {
forceSSL = false;
enableACME = false;
};
};
services.mysql = {
enable = true;
package = pkgs.mysql;
};
services.nginx.enable = true;
};
};
testScript = ''
start_all()
matomo_beta.wait_for_unit("mysql.service")
matomo_beta.wait_for_unit("phpfpm-matomo.service")
matomo_beta.wait_for_unit("nginx.service")
# without the grep the command does not produce valid utf-8 for some reason
with subtest("welcome screen loads"):
matomo_beta.succeed(
"curl -sSfL http://localhost/ | grep '<title>Matomo[^<]*Installation'"
)
'';
};
in
{
matomo-stable = matomoTest pkgs.matomo // {
name = "matomo";
meta.maintainers = with maintainers; [ florianjacob kiwi mmilata ];
};
matomo-beta = matomoBetaTest pkgs.matomo-beta // {
name = "matomo-beta";
meta.maintainers = with maintainers; [ florianjacob kiwi mmilata ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment