1import ../make-test-python.nix (
2 { lib, pkgs, ... }:
3
4 {
5 name = "vector-api";
6 meta.maintainers = [ pkgs.lib.maintainers.happysalada ];
7
8 nodes.machineapi =
9 { config, pkgs, ... }:
10 {
11 services.vector = {
12 enable = true;
13 journaldAccess = false;
14 settings = {
15 api.enabled = true;
16
17 sources = {
18 demo_logs = {
19 type = "demo_logs";
20 format = "json";
21 };
22 };
23
24 sinks = {
25 file = {
26 type = "file";
27 inputs = [ "demo_logs" ];
28 path = "/var/lib/vector/logs.log";
29 encoding = {
30 codec = "json";
31 };
32 };
33 };
34 };
35 };
36 };
37
38 testScript = ''
39 machineapi.wait_for_unit("vector")
40 machineapi.wait_for_open_port(8686)
41 machineapi.succeed("journalctl -o cat -u vector.service | grep 'API server running'")
42 machineapi.wait_until_succeeds("curl -sSf http://localhost:8686/health")
43 '';
44 }
45)