summary refs log tree commit diff
path: root/nixos/tests/matomo.nix
blob: 526a24fc4db758ce8385b863f51c8929e23701cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{ 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.machine = { config, pkgs, ... }: {
      services.matomo = {
        package = package;
        enable = true;
        nginx = {
          forceSSL = false;
          enableACME = false;
        };
      };
      services.mysql = {
        enable = true;
        package = pkgs.mariadb;
      };
      services.nginx.enable = true;
    };

    testScript = ''
      start_all()
      machine.wait_for_unit("mysql.service")
      machine.wait_for_unit("phpfpm-matomo.service")
      machine.wait_for_unit("nginx.service")

      # without the grep the command does not produce valid utf-8 for some reason
      with subtest("welcome screen loads"):
          machine.succeed(
              "curl -sSfL http://localhost/ | grep '<title>Matomo[^<]*Installation'"
          )
    '';
  };
in {
  matomo = matomoTest pkgs.matomo // {
    name = "matomo";
    meta.maintainers = with maintainers; [ florianjacob kiwi mmilata ];
  };
  matomo-beta = matomoTest pkgs.matomo-beta // {
    name = "matomo-beta";
    meta.maintainers = with maintainers; [ florianjacob kiwi mmilata ];
  };
}