nixos/victorialogs: add integration test with vlagent

Shawn8901 cea3b9b1 37deae36

Changed files
+65 -2
nixos
+1 -1
nixos/tests/all-tests.nix
···
vector = import ./vector { inherit runTest; };
velocity = runTest ./velocity.nix;
vengi-tools = runTest ./vengi-tools.nix;
-
victorialogs = runTest ./victorialogs.nix;
+
victorialogs = import ./victorialogs { inherit runTest; };
victoriametrics = import ./victoriametrics { inherit runTest; };
vikunja = runTest ./vikunja.nix;
virtualbox = handleTestOn [ "x86_64-linux" ] ./virtualbox.nix { };
+1 -1
nixos/tests/victorialogs.nix nixos/tests/victorialogs/local-write.nix
···
{ lib, ... }:
{
-
name = "victorialogs";
+
name = "victorialogs-local-write";
meta.maintainers = with lib.maintainers; [ marie ];
nodes.machine =
+5
nixos/tests/victorialogs/default.nix
···
+
{ runTest }:
+
{
+
local-write = runTest ./local-write.nix;
+
remote-write-with-vlagent = runTest ./remote-write-with-vlagent.nix;
+
}
+58
nixos/tests/victorialogs/remote-write-with-vlagent.nix
···
+
{ lib, pkgs, ... }:
+
let
+
+
username = "vltest";
+
password = "rUceu1W41U"; # random string
+
passwordFile = pkgs.writeText "password-file" password;
+
in
+
{
+
name = "victorialogs-remote-write-with-vlagent";
+
meta.maintainers = [ lib.maintainers.shawn8901 ];
+
+
nodes.server =
+
{ pkgs, ... }:
+
{
+
networking.firewall.allowedTCPPorts = [ 9428 ];
+
services.victorialogs = {
+
enable = true;
+
basicAuthUsername = username;
+
basicAuthPasswordFile = toString passwordFile;
+
};
+
};
+
+
nodes.client =
+
{ pkgs, ... }:
+
{
+
services.vlagent = {
+
enable = true;
+
remoteWrite = {
+
url = "http://server:9428/internal/insert";
+
basicAuthUsername = username;
+
basicAuthPasswordFile = toString passwordFile;
+
};
+
};
+
+
services.journald.upload = {
+
enable = true;
+
settings = {
+
Upload.URL = "http://localhost:9429/insert/journald";
+
};
+
};
+
environment.systemPackages = [ pkgs.curl ];
+
+
};
+
+
testScript = ''
+
server.wait_for_unit("victorialogs.service")
+
server.wait_for_open_port(9428)
+
+
client.wait_for_unit("vlagent")
+
client.wait_for_open_port(9429)
+
+
client.wait_for_unit("systemd-journal-upload")
+
+
client.succeed("echo 'meow' | systemd-cat -p info")
+
+
server.wait_until_succeeds("curl -u ${username}:${password} --fail http://localhost:9428/select/logsql/query -d 'query=\"meow\"' | grep meow")
+
'';
+
}