nixosTests.zenohd: migrate to runTest

Part Of #386873
This commit is contained in:
Martin Weinelt 2025-03-14 22:51:56 +01:00
parent 052ef614f6
commit e3c80a49c8
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
2 changed files with 72 additions and 75 deletions

View File

@ -1303,7 +1303,7 @@ in {
yggdrasil = handleTest ./yggdrasil.nix {}; yggdrasil = handleTest ./yggdrasil.nix {};
your_spotify = handleTest ./your_spotify.nix {}; your_spotify = handleTest ./your_spotify.nix {};
zammad = handleTest ./zammad.nix {}; zammad = handleTest ./zammad.nix {};
zenohd = handleTest ./zenohd.nix {}; zenohd = runTest ./zenohd.nix;
zeronet-conservancy = runTest ./zeronet-conservancy.nix; zeronet-conservancy = runTest ./zeronet-conservancy.nix;
zfs = handleTest ./zfs.nix {}; zfs = handleTest ./zfs.nix {};
zigbee2mqtt_1 = runTest { zigbee2mqtt_1 = runTest {

View File

@ -1,71 +1,68 @@
import ./make-test-python.nix ( { pkgs, lib, ... }:
{ pkgs, lib, ... }:
{ {
name = "zenohd"; name = "zenohd";
meta.maintainers = [ lib.maintainers.markuskowa ]; meta.maintainers = [ lib.maintainers.markuskowa ];
nodes = { nodes = {
router = router =
{ {
pkgs, pkgs,
lib, config,
config, ...
... }:
}: {
{ networking.firewall.allowedTCPPorts = [
networking.firewall.allowedTCPPorts = [ 7447 # zenohd default port
7447 # zenohd default port config.services.zenohd.settings.plugins.mqtt.port
config.services.zenohd.settings.plugins.mqtt.port config.services.zenohd.settings.plugins.webserver.http_port
config.services.zenohd.settings.plugins.webserver.http_port ];
services.zenohd = {
enable = true;
plugins = with pkgs; [
zenoh-plugin-mqtt
zenoh-plugin-webserver
]; ];
services.zenohd = { backends = with pkgs; [
enable = true; zenoh-backend-filesystem
zenoh-backend-rocksdb
];
plugins = with pkgs; [ settings = {
zenoh-plugin-mqtt plugins = {
zenoh-plugin-webserver mqtt = {
]; port = 1883;
allow = ".*";
backends = with pkgs; [ };
zenoh-backend-filesystem webserver.http_port = 8000;
zenoh-backend-rocksdb storage_manager = {
]; volumes = {
fs = { };
settings = { rocksdb = { };
plugins = {
mqtt = {
port = 1883;
allow = ".*";
}; };
webserver.http_port = 8000; storages = {
storage_manager = { mem = {
volumes = { key_expr = "mem/**";
fs = { }; volume = "memory";
rocksdb = { };
}; };
storages = { fs = {
mem = { key_expr = "fs/**";
key_expr = "mem/**"; volume = {
volume = "memory"; id = "fs";
dir = "zenoh-fs";
strip_prefix = "fs";
}; };
fs = { };
key_expr = "fs/**"; rocksdb = {
volume = { key_expr = "rocksdb/**";
id = "fs"; volume = {
dir = "zenoh-fs"; id = "rocksdb";
strip_prefix = "fs"; dir = "zenoh-rocksdb";
}; strip_prefix = "rocksdb";
}; create_db = true;
rocksdb = {
key_expr = "rocksdb/**";
volume = {
id = "rocksdb";
dir = "zenoh-rocksdb";
strip_prefix = "rocksdb";
create_db = true;
};
}; };
}; };
}; };
@ -73,21 +70,21 @@ import ./make-test-python.nix (
}; };
}; };
}; };
client = {
environment.systemPackages = [
pkgs.mosquitto
];
}; };
client = {
environment.systemPackages = [
pkgs.mosquitto
];
}; };
};
testScript = '' testScript = ''
router.wait_for_unit("zenohd.service") router.wait_for_unit("zenohd.service")
client.wait_for_unit("multi-user.target") client.wait_for_unit("multi-user.target")
for be in ["fs", "rocksdb", "mem" ]: for be in ["fs", "rocksdb", "mem" ]:
client.succeed(f"mosquitto_pub -h router -t {be}/test -m hello") client.succeed(f"mosquitto_pub -h router -t {be}/test -m hello")
client.succeed(f"curl router:8000/{be}/test | grep hello") client.succeed(f"curl router:8000/{be}/test | grep hello")
''; '';
} }
)