nixos/tests/umami: init
This commit is contained in:
parent
5d6b6bad55
commit
35b5939fee
@ -1489,6 +1489,7 @@ in
|
|||||||
ucarp = runTest ./ucarp.nix;
|
ucarp = runTest ./ucarp.nix;
|
||||||
udisks2 = runTest ./udisks2.nix;
|
udisks2 = runTest ./udisks2.nix;
|
||||||
ulogd = runTest ./ulogd/ulogd.nix;
|
ulogd = runTest ./ulogd/ulogd.nix;
|
||||||
|
umami = runTest ./web-apps/umami.nix;
|
||||||
umurmur = runTest ./umurmur.nix;
|
umurmur = runTest ./umurmur.nix;
|
||||||
unbound = runTest ./unbound.nix;
|
unbound = runTest ./unbound.nix;
|
||||||
unifi = runTest ./unifi.nix;
|
unifi = runTest ./unifi.nix;
|
||||||
|
|||||||
45
nixos/tests/web-apps/umami.nix
Normal file
45
nixos/tests/web-apps/umami.nix
Normal 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"
|
||||||
|
'';
|
||||||
|
}
|
||||||
@ -4,6 +4,7 @@
|
|||||||
fetchFromGitHub,
|
fetchFromGitHub,
|
||||||
fetchurl,
|
fetchurl,
|
||||||
makeWrapper,
|
makeWrapper,
|
||||||
|
nixosTests,
|
||||||
nodejs,
|
nodejs,
|
||||||
pnpm_10,
|
pnpm_10,
|
||||||
prisma-engines,
|
prisma-engines,
|
||||||
@ -174,6 +175,9 @@ stdenvNoCC.mkDerivation (finalAttrs: {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
|
tests = {
|
||||||
|
inherit (nixosTests) umami;
|
||||||
|
};
|
||||||
inherit
|
inherit
|
||||||
sources
|
sources
|
||||||
geocities
|
geocities
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user