nixos/victorialogs: add integration test with vlagent

Shawn8901 cea3b9b1 37deae36

+65 -2
+1 -1
nixos/tests/all-tests.nix
··· 1547 1547 vector = import ./vector { inherit runTest; }; 1548 1548 velocity = runTest ./velocity.nix; 1549 1549 vengi-tools = runTest ./vengi-tools.nix; 1550 - victorialogs = runTest ./victorialogs.nix; 1550 + victorialogs = import ./victorialogs { inherit runTest; }; 1551 1551 victoriametrics = import ./victoriametrics { inherit runTest; }; 1552 1552 vikunja = runTest ./vikunja.nix; 1553 1553 virtualbox = handleTestOn [ "x86_64-linux" ] ./virtualbox.nix { };
+1 -1
nixos/tests/victorialogs.nix nixos/tests/victorialogs/local-write.nix
··· 1 1 { lib, ... }: 2 2 { 3 - name = "victorialogs"; 3 + name = "victorialogs-local-write"; 4 4 meta.maintainers = with lib.maintainers; [ marie ]; 5 5 6 6 nodes.machine =
+5
nixos/tests/victorialogs/default.nix
··· 1 + { runTest }: 2 + { 3 + local-write = runTest ./local-write.nix; 4 + remote-write-with-vlagent = runTest ./remote-write-with-vlagent.nix; 5 + }
+58
nixos/tests/victorialogs/remote-write-with-vlagent.nix
··· 1 + { lib, pkgs, ... }: 2 + let 3 + 4 + username = "vltest"; 5 + password = "rUceu1W41U"; # random string 6 + passwordFile = pkgs.writeText "password-file" password; 7 + in 8 + { 9 + name = "victorialogs-remote-write-with-vlagent"; 10 + meta.maintainers = [ lib.maintainers.shawn8901 ]; 11 + 12 + nodes.server = 13 + { pkgs, ... }: 14 + { 15 + networking.firewall.allowedTCPPorts = [ 9428 ]; 16 + services.victorialogs = { 17 + enable = true; 18 + basicAuthUsername = username; 19 + basicAuthPasswordFile = toString passwordFile; 20 + }; 21 + }; 22 + 23 + nodes.client = 24 + { pkgs, ... }: 25 + { 26 + services.vlagent = { 27 + enable = true; 28 + remoteWrite = { 29 + url = "http://server:9428/internal/insert"; 30 + basicAuthUsername = username; 31 + basicAuthPasswordFile = toString passwordFile; 32 + }; 33 + }; 34 + 35 + services.journald.upload = { 36 + enable = true; 37 + settings = { 38 + Upload.URL = "http://localhost:9429/insert/journald"; 39 + }; 40 + }; 41 + environment.systemPackages = [ pkgs.curl ]; 42 + 43 + }; 44 + 45 + testScript = '' 46 + server.wait_for_unit("victorialogs.service") 47 + server.wait_for_open_port(9428) 48 + 49 + client.wait_for_unit("vlagent") 50 + client.wait_for_open_port(9429) 51 + 52 + client.wait_for_unit("systemd-journal-upload") 53 + 54 + client.succeed("echo 'meow' | systemd-cat -p info") 55 + 56 + server.wait_until_succeeds("curl -u ${username}:${password} --fail http://localhost:9428/select/logsql/query -d 'query=\"meow\"' | grep meow") 57 + ''; 58 + }