summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorVictor Freire <victor@freire.dev.br>2022-02-10 19:44:18 -0300
committerVictor Freire <victor@freire.dev.br>2022-02-14 22:48:32 -0300
commit6532d3417ea247f5088649027a9719a34ad64406 (patch)
treef15067e43f3f2f6665dea851dd366b5cbc74a0db /nixos/tests
parent8429cc4ffdba21887b9f1c4be6940b5e61e77ca4 (diff)
downloadnixpkgs-6532d3417ea247f5088649027a9719a34ad64406.tar
nixpkgs-6532d3417ea247f5088649027a9719a34ad64406.tar.gz
nixpkgs-6532d3417ea247f5088649027a9719a34ad64406.tar.bz2
nixpkgs-6532d3417ea247f5088649027a9719a34ad64406.tar.lz
nixpkgs-6532d3417ea247f5088649027a9719a34ad64406.tar.xz
nixpkgs-6532d3417ea247f5088649027a9719a34ad64406.tar.zst
nixpkgs-6532d3417ea247f5088649027a9719a34ad64406.zip
nixos/blocky: init
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/blocky.nix34
2 files changed, 35 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 3fd4945ed35..10a6de93be2 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -51,6 +51,7 @@ in
   bitcoind = handleTest ./bitcoind.nix {};
   bittorrent = handleTest ./bittorrent.nix {};
   blockbook-frontend = handleTest ./blockbook-frontend.nix {};
+  blocky = handleTest ./blocky.nix {};
   boot = handleTestOn ["x86_64-linux" "aarch64-linux"] ./boot.nix {};
   boot-stage1 = handleTest ./boot-stage1.nix {};
   borgbackup = handleTest ./borgbackup.nix {};
diff --git a/nixos/tests/blocky.nix b/nixos/tests/blocky.nix
new file mode 100644
index 00000000000..18e7f45e1c7
--- /dev/null
+++ b/nixos/tests/blocky.nix
@@ -0,0 +1,34 @@
+import ./make-test-python.nix {
+  name = "blocky";
+
+  nodes = {
+    server = { pkgs, ... }: {
+      environment.systemPackages = [ pkgs.dnsutils ];
+      services.blocky = {
+        enable = true;
+
+        settings = {
+          customDNS = {
+            mapping = {
+              "printer.lan" = "192.168.178.3,2001:0db8:85a3:08d3:1319:8a2e:0370:7344";
+            };
+          };
+          upstream = {
+            default = [ "8.8.8.8" "1.1.1.1" ];
+          };
+          port = 53;
+          httpPort = 5000;
+          logLevel = "info";
+        };
+      };
+    };
+  };
+
+  testScript = ''
+    with subtest("Service test"):
+        server.wait_for_unit("blocky.service")
+        server.wait_for_open_port(53)
+        server.wait_for_open_port(5000)
+        server.succeed("dig @127.0.0.1 +short -x 192.168.178.3 | grep -qF printer.lan")
+  '';
+}