Last active
December 1, 2019 18:07
-
-
Save Kiwi/48e8160134ed08164923d32594dd3298 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ 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