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