nixos/tests/umami: init

This commit is contained in:
Diogo Correia
2025-02-10 13:39:09 +00:00
committed by Niklas Hambüchen
parent 5d6b6bad55
commit 35b5939fee
3 changed files with 50 additions and 0 deletions

View File

@@ -1489,6 +1489,7 @@ in
ucarp = runTest ./ucarp.nix;
udisks2 = runTest ./udisks2.nix;
ulogd = runTest ./ulogd/ulogd.nix;
umami = runTest ./web-apps/umami.nix;
umurmur = runTest ./umurmur.nix;
unbound = runTest ./unbound.nix;
unifi = runTest ./unifi.nix;

View File

@@ -0,0 +1,45 @@
{ lib, ... }:
{
name = "umami-nixos";
meta.maintainers = with lib.maintainers; [ diogotcorreia ];
nodes.machine =
{ pkgs, ... }:
{
services.umami = {
enable = true;
settings = {
APP_SECRET = "very_secret";
};
};
};
testScript = ''
import json
machine.wait_for_unit("umami.service")
machine.wait_for_open_port(3000)
machine.succeed("curl --fail http://localhost:3000/")
machine.succeed("curl --fail http://localhost:3000/script.js")
res = machine.succeed("""
curl -f --json '{ "username": "admin", "password": "umami" }' http://localhost:3000/api/auth/login
""")
token = json.loads(res)['token']
res = machine.succeed("""
curl -f -H 'Authorization: Bearer %s' --json '{ "domain": "localhost", "name": "Test" }' http://localhost:3000/api/websites
""" % token)
print(res)
websiteId = json.loads(res)['id']
res = machine.succeed("""
curl -f -H 'Authorization: Bearer %s' http://localhost:3000/api/websites/%s
""" % (token, websiteId))
website = json.loads(res)
assert website["name"] == "Test"
assert website["domain"] == "localhost"
'';
}

View File

@@ -4,6 +4,7 @@
fetchFromGitHub,
fetchurl,
makeWrapper,
nixosTests,
nodejs,
pnpm_10,
prisma-engines,
@@ -174,6 +175,9 @@ stdenvNoCC.mkDerivation (finalAttrs: {
'';
passthru = {
tests = {
inherit (nixosTests) umami;
};
inherit
sources
geocities