From 1a5d3070ac825a080f21013364f01928e0920076 Mon Sep 17 00:00:00 2001
From: Martin Milata <martin@martinmilata.cz>
Date: Sun, 1 Dec 2019 00:50:55 +0100
Subject: [PATCH] nixosTests.matomo: port to python

---
 nixos/tests/matomo.nix | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/nixos/tests/matomo.nix b/nixos/tests/matomo.nix
index 4efa65a7b6d..2bea237c8bd 100644
--- a/nixos/tests/matomo.nix
+++ b/nixos/tests/matomo.nix
@@ -1,7 +1,7 @@
 { system ? builtins.currentSystem, config ? { }
 , pkgs ? import ../.. { inherit system config; } }:
 
-with import ../lib/testing.nix { inherit system pkgs; };
+with import ../lib/testing-python.nix { inherit system pkgs; };
 with pkgs.lib;
 
 let
@@ -24,11 +24,16 @@ let
     };
 
     testScript = ''
-      startAll;
-      $machine->waitForUnit("mysql.service");
-      $machine->waitForUnit("phpfpm-matomo.service");
-      $machine->waitForUnit("nginx.service");
-      $machine->succeed("curl -sSfL http://localhost/ | grep '<title>Matomo[^<]*Installation'");
+      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 {