about summary refs log tree commit diff
path: root/nixos/tests/libreddit.nix
diff options
context:
space:
mode:
authorAlexandre Iooss <erdnaxe@crans.org>2021-08-13 15:47:24 +0200
committerAlexandre Iooss <erdnaxe@crans.org>2021-12-28 12:14:07 +0100
commitf04ef2a25b292144ba7856c96b2a96fee99639dc (patch)
tree7eac5defb858570b05b6d35d85ccc077c679fd02 /nixos/tests/libreddit.nix
parentd68f731ba246add4c4e456d829eb19136e65290e (diff)
nixos/libreddit: do not test an error
The current test needs Reddit access, which we do not have in testing
environment. This commit tests the settings page of libreddit which does
not require network access. It also test if the service can run on port
80 with the CAP_NET_BIND_SERVICE capability.
Diffstat (limited to 'nixos/tests/libreddit.nix')
-rw-r--r--nixos/tests/libreddit.nix14
1 files changed, 8 insertions, 6 deletions
diff --git a/nixos/tests/libreddit.nix b/nixos/tests/libreddit.nix
index f7ef701d0865f..01f6aeffb3661 100644
--- a/nixos/tests/libreddit.nix
+++ b/nixos/tests/libreddit.nix
@@ -6,14 +6,16 @@ with lib;
   name = "libreddit";
   meta.maintainers = with maintainers; [ fab ];
 
-  nodes.machine =
-    { pkgs, ... }:
-    { services.libreddit.enable = true; };
+  nodes.machine = {
+    services.libreddit.enable = true;
+    # Test CAP_NET_BIND_SERVICE
+    services.libreddit.port = 80;
+  };
 
   testScript = ''
     machine.wait_for_unit("libreddit.service")
-    machine.wait_for_open_port("8080")
-    # The service wants to get data from https://www.reddit.com
-    machine.succeed("curl http://localhost:8080/")
+    machine.wait_for_open_port("80")
+    # Query a page that does not require Internet access
+    machine.succeed("curl --fail http://localhost:80/settings")
   '';
 })