lol

nixos/tests/umami: init

authored by

Diogo Correia and committed by
Niklas Hambüchen
35b5939f 5d6b6bad

+50
+1
nixos/tests/all-tests.nix
··· 1489 1489 ucarp = runTest ./ucarp.nix; 1490 1490 udisks2 = runTest ./udisks2.nix; 1491 1491 ulogd = runTest ./ulogd/ulogd.nix; 1492 + umami = runTest ./web-apps/umami.nix; 1492 1493 umurmur = runTest ./umurmur.nix; 1493 1494 unbound = runTest ./unbound.nix; 1494 1495 unifi = runTest ./unifi.nix;
+45
nixos/tests/web-apps/umami.nix
··· 1 + { lib, ... }: 2 + { 3 + name = "umami-nixos"; 4 + 5 + meta.maintainers = with lib.maintainers; [ diogotcorreia ]; 6 + 7 + nodes.machine = 8 + { pkgs, ... }: 9 + { 10 + services.umami = { 11 + enable = true; 12 + settings = { 13 + APP_SECRET = "very_secret"; 14 + }; 15 + }; 16 + }; 17 + 18 + testScript = '' 19 + import json 20 + 21 + machine.wait_for_unit("umami.service") 22 + 23 + machine.wait_for_open_port(3000) 24 + machine.succeed("curl --fail http://localhost:3000/") 25 + machine.succeed("curl --fail http://localhost:3000/script.js") 26 + 27 + res = machine.succeed(""" 28 + curl -f --json '{ "username": "admin", "password": "umami" }' http://localhost:3000/api/auth/login 29 + """) 30 + token = json.loads(res)['token'] 31 + 32 + res = machine.succeed(""" 33 + curl -f -H 'Authorization: Bearer %s' --json '{ "domain": "localhost", "name": "Test" }' http://localhost:3000/api/websites 34 + """ % token) 35 + print(res) 36 + websiteId = json.loads(res)['id'] 37 + 38 + res = machine.succeed(""" 39 + curl -f -H 'Authorization: Bearer %s' http://localhost:3000/api/websites/%s 40 + """ % (token, websiteId)) 41 + website = json.loads(res) 42 + assert website["name"] == "Test" 43 + assert website["domain"] == "localhost" 44 + ''; 45 + }
+4
pkgs/by-name/um/umami/package.nix
··· 4 4 fetchFromGitHub, 5 5 fetchurl, 6 6 makeWrapper, 7 + nixosTests, 7 8 nodejs, 8 9 pnpm_10, 9 10 prisma-engines, ··· 174 175 ''; 175 176 176 177 passthru = { 178 + tests = { 179 + inherit (nixosTests) umami; 180 + }; 177 181 inherit 178 182 sources 179 183 geocities