blob: 51d53c78f2f9c72d6e2775554efc423f23e5e647 (
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
49
|
kittybox:
{ lib, ... }: {
name = "nixos-kittybox";
nodes = {
kittybox = { config, pkgs, lib, ... }: {
imports = [ kittybox.nixosModules.default ];
services.postgresql = {
enable = true;
ensureDatabases = ["kittybox"];
ensureUsers = [ {
name = "kittybox";
ensurePermissions = {
"DATABASE kittybox" = "ALL PRIVILEGES";
};
} ];
};
services.kittybox = {
enable = true;
logLevel = "info,kittybox=debug,retainer::cache=warn,h2=warn,rustls=warn";
backendUri = "postgres://localhost?host=/run/postgresql&dbname=kittybox";
};
systemd.services.kittybox.wants = [ "postgresql.service" ];
systemd.services.kittybox.after = [ "postgresql.service" ];
environment.systemPackages = with pkgs; [
xh
];
};
};
# TODO: Make e2e tests for authentication endpoints and such
# Potentially using WebDriver
# Could also be implemented with fantoccini
testScript = ''
with subtest("Verify that Kittybox started correctly..."):
kittybox.wait_for_open_port(8080)
kittybox.succeed("xh --no-check-status http://localhost:8080/.kittybox/micropub")
with subtest("Onboarding should correctly work..."):
kittybox.copy_from_host("${./onboarding.json}", "/root/onboarding.json")
kittybox.succeed("xh --follow http://localhost:8080/.kittybox/onboarding -j @/root/onboarding.json")
# Testing for a known string is the easiest way to determine that the onboarding worked
kittybox.succeed("xh http://localhost:8080/ | grep 'vestige of the past long gone'")
'';
}
|