python312Packages.arviz: fix build, python312Packages.numba: skip failing test on...
[NixPkgs.git] / nixos / tests / zenohd.nix
blob0aeca6b6181881e0496dd2cd7da46772bcf940cc
1 import ./make-test-python.nix (
2   { pkgs, lib, ... }:
4   {
5     name = "zenohd";
6     meta.maintainers = [ lib.maintainers.markuskowa ];
8     nodes = {
9       router =
10         {
11           pkgs,
12           lib,
13           config,
14           ...
15         }:
16         {
17           networking.firewall.allowedTCPPorts = [
18             7447 # zenohd default port
19             config.services.zenohd.settings.plugins.mqtt.port
20             config.services.zenohd.settings.plugins.webserver.http_port
21           ];
23           services.zenohd = {
24             enable = true;
26             plugins = with pkgs; [
27               zenoh-plugin-mqtt
28               zenoh-plugin-webserver
29             ];
31             backends = with pkgs; [
32               zenoh-backend-filesystem
33               zenoh-backend-rocksdb
34             ];
36             settings = {
37               plugins = {
38                 mqtt = {
39                   port = 1883;
40                   allow = ".*";
41                 };
42                 webserver.http_port = 8000;
43                 storage_manager = {
44                   volumes = {
45                     fs = { };
46                     rocksdb = { };
47                   };
48                   storages = {
49                     mem = {
50                       key_expr = "mem/**";
51                       volume = "memory";
52                     };
53                     fs = {
54                       key_expr = "fs/**";
55                       volume = {
56                         id = "fs";
57                         dir = "zenoh-fs";
58                         strip_prefix = "fs";
59                       };
60                     };
61                     rocksdb = {
62                       key_expr = "rocksdb/**";
63                       volume = {
64                         id = "rocksdb";
65                         dir = "zenoh-rocksdb";
66                         strip_prefix = "rocksdb";
67                         create_db = true;
68                       };
69                     };
70                   };
71                 };
72               };
73             };
74           };
75         };
77       client = {
78         environment.systemPackages = [
79           pkgs.mosquitto
80         ];
81       };
82     };
84     testScript = ''
85       router.wait_for_unit("zenohd.service")
86       client.wait_for_unit("multi-user.target")
88       for be in ["fs", "rocksdb", "mem" ]:
89         client.succeed(f"mosquitto_pub -h router -t {be}/test -m hello")
90         client.succeed(f"curl router:8000/{be}/test | grep hello")
91     '';
92   }