summary refs log tree commit diff
diff options
context:
space:
mode:
authorAntoine Eiche <lewo@abesis.fr>2020-11-01 18:48:40 +0100
committerAntoine Eiche <lewo@abesis.fr>2020-11-02 09:07:52 +0100
commit81063ee414ecf461f697b54678dad3163fe37e38 (patch)
treea9df44f27627723a6fd8be8719315a2835f4d6fd
parent859a44ebc0b4f54c8053884c9bf1d8496ada0bf8 (diff)
downloadnixpkgs-81063ee414ecf461f697b54678dad3163fe37e38.tar
nixpkgs-81063ee414ecf461f697b54678dad3163fe37e38.tar.gz
nixpkgs-81063ee414ecf461f697b54678dad3163fe37e38.tar.bz2
nixpkgs-81063ee414ecf461f697b54678dad3163fe37e38.tar.lz
nixpkgs-81063ee414ecf461f697b54678dad3163fe37e38.tar.xz
nixpkgs-81063ee414ecf461f697b54678dad3163fe37e38.tar.zst
nixpkgs-81063ee414ecf461f697b54678dad3163fe37e38.zip
nixos.tests.systemd-journal: add basic systemd-journal-gatewayd test
This test allows to ensure the systemd-journal-gatewayd service is
responding correcly when the NixOS option `enableHttpGateway` is set.

The test has not been added into the main systemd test because a
graphical stack is not required (and rebuilding the graphical stack on
systemd change is huge).
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/systemd-journal.nix20
2 files changed, 21 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 9ffeba27a7f..02ac737dbe1 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -340,6 +340,7 @@ in
   systemd-binfmt = handleTestOn ["x86_64-linux"] ./systemd-binfmt.nix {};
   systemd-boot = handleTest ./systemd-boot.nix {};
   systemd-confinement = handleTest ./systemd-confinement.nix {};
+  systemd-journal = handleTest ./systemd-journal.nix {};
   systemd-timesyncd = handleTest ./systemd-timesyncd.nix {};
   systemd-networkd-vrf = handleTest ./systemd-networkd-vrf.nix {};
   systemd-networkd = handleTest ./systemd-networkd.nix {};
diff --git a/nixos/tests/systemd-journal.nix b/nixos/tests/systemd-journal.nix
new file mode 100644
index 00000000000..c50c151ae10
--- /dev/null
+++ b/nixos/tests/systemd-journal.nix
@@ -0,0 +1,20 @@
+import ./make-test-python.nix ({ pkgs, ... }:
+
+{
+  name = "systemd-journal";
+  meta = with pkgs.stdenv.lib.maintainers; {
+    maintainers = [ lewo ];
+  };
+
+  machine = { pkgs, lib, ... }: {
+    services.journald.enableHttpGateway = true;
+  };
+
+  testScript = ''
+    machine.wait_for_unit("multi-user.target")
+
+    machine.succeed(
+        "${pkgs.curl}/bin/curl -s localhost:19531/machine | ${pkgs.jq}/bin/jq -e '.hostname == \"machine\"'"
+    )
+  '';
+})