about summary refs log tree commit diff
path: root/nixos/tests/alloy.nix
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-06-08 18:31:12 +0300
committerFlorian Klink <flokli@flokli.de>2024-06-10 13:35:33 +0300
commitc12da487556dd0e1dd6e8b98a072932c1f97881a (patch)
tree5e888ebd0fad8a96d3cae7fd178966d02307ff8a /nixos/tests/alloy.nix
parent486f515d4720ae9a4a7790f4cdcb4686efe5bcf5 (diff)
nixosTests.alloy: init VM test
This adds a VM test, starting up Grafana Alloy and ensuring it comes
up healthy.
Diffstat (limited to 'nixos/tests/alloy.nix')
-rw-r--r--nixos/tests/alloy.nix32
1 files changed, 32 insertions, 0 deletions
diff --git a/nixos/tests/alloy.nix b/nixos/tests/alloy.nix
new file mode 100644
index 0000000000000..814a21d1e9523
--- /dev/null
+++ b/nixos/tests/alloy.nix
@@ -0,0 +1,32 @@
+import ./make-test-python.nix ({ lib, pkgs, ... }:
+
+  let
+    nodes = {
+      machine = {
+        services.alloy = {
+          enable = true;
+        };
+        environment.etc."alloy/config.alloy".text = "";
+      };
+    };
+  in
+  {
+    name = "alloy";
+
+    meta = with lib.maintainers; {
+      maintainers = [ flokli ];
+    };
+
+    inherit nodes;
+
+    testScript = ''
+      start_all()
+
+      machine.wait_for_unit("alloy.service")
+      machine.wait_for_open_port(12345)
+      machine.succeed(
+          "curl -sSfN http://127.0.0.1:12345/-/healthy"
+      )
+      machine.shutdown()
+    '';
+  })