diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2024-02-03 06:01:25 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-03 06:01:25 +0000 |
commit | 95ffc370248500f0d276a15dfe67887e2ab753b6 (patch) | |
tree | fa767cf623f25a34c67383ffce344f0cf228604e /nixos | |
parent | 0658c54cd9a962b3a121ca02542815d8de939867 (diff) | |
parent | 24ac0b438f8595b5bae26d6fd3185de2885213de (diff) | |
download | nixlib-95ffc370248500f0d276a15dfe67887e2ab753b6.tar nixlib-95ffc370248500f0d276a15dfe67887e2ab753b6.tar.gz nixlib-95ffc370248500f0d276a15dfe67887e2ab753b6.tar.bz2 nixlib-95ffc370248500f0d276a15dfe67887e2ab753b6.tar.lz nixlib-95ffc370248500f0d276a15dfe67887e2ab753b6.tar.xz nixlib-95ffc370248500f0d276a15dfe67887e2ab753b6.tar.zst nixlib-95ffc370248500f0d276a15dfe67887e2ab753b6.zip |
Merge staging-next into staging
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/home-automation/zigbee2mqtt.nix | 1 | ||||
-rw-r--r-- | nixos/tests/all-tests.nix | 1 | ||||
-rw-r--r-- | nixos/tests/nvmetcfg.nix | 43 | ||||
-rw-r--r-- | nixos/tests/zigbee2mqtt.nix | 13 |
4 files changed, 56 insertions, 2 deletions
diff --git a/nixos/modules/services/home-automation/zigbee2mqtt.nix b/nixos/modules/services/home-automation/zigbee2mqtt.nix index a653e49a09f6..570ce41aa6d4 100644 --- a/nixos/modules/services/home-automation/zigbee2mqtt.nix +++ b/nixos/modules/services/home-automation/zigbee2mqtt.nix @@ -71,6 +71,7 @@ in after = [ "network.target" ]; environment.ZIGBEE2MQTT_DATA = cfg.dataDir; serviceConfig = { + Type = "notify"; ExecStart = "${cfg.package}/bin/zigbee2mqtt"; User = "zigbee2mqtt"; Group = "zigbee2mqtt"; diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index f52e37d782bd..c943179051cc 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -627,6 +627,7 @@ in { ntfy-sh = handleTest ./ntfy-sh.nix {}; ntfy-sh-migration = handleTest ./ntfy-sh-migration.nix {}; ntpd-rs = handleTest ./ntpd-rs.nix {}; + nvmetcfg = handleTest ./nvmetcfg.nix {}; nzbget = handleTest ./nzbget.nix {}; nzbhydra2 = handleTest ./nzbhydra2.nix {}; oh-my-zsh = handleTest ./oh-my-zsh.nix {}; diff --git a/nixos/tests/nvmetcfg.nix b/nixos/tests/nvmetcfg.nix new file mode 100644 index 000000000000..a4c459a343cf --- /dev/null +++ b/nixos/tests/nvmetcfg.nix @@ -0,0 +1,43 @@ +import ./make-test-python.nix ({ lib, ... }: { + name = "nvmetcfg"; + + meta = { + maintainers = with lib.maintainers; [ nickcao ]; + }; + + nodes = { + server = { pkgs, ... }: { + boot.kernelModules = [ "nvmet" ]; + environment.systemPackages = [ pkgs.nvmetcfg ]; + networking.firewall.allowedTCPPorts = [ 4420 ]; + virtualisation.emptyDiskImages = [ 512 ]; + }; + client = { pkgs, ... }: { + boot.kernelModules = [ "nvme-fabrics" ]; + environment.systemPackages = [ pkgs.nvme-cli ]; + }; + }; + + testScript = let subsystem = "nqn.2014-08.org.nixos:server"; in '' + import json + + with subtest("Create subsystem and namespace"): + server.succeed("nvmet subsystem add ${subsystem}") + server.succeed("nvmet namespace add ${subsystem} 1 /dev/vdb") + + with subtest("Bind subsystem to port"): + server.wait_for_unit("network-online.target") + server.succeed("nvmet port add 1 tcp 0.0.0.0:4420") + server.succeed("nvmet port add-subsystem 1 ${subsystem}") + + with subtest("Discover and connect to available subsystems"): + client.wait_for_unit("network-online.target") + assert "subnqn: ${subsystem}" in client.succeed("nvme discover --transport=tcp --traddr=server --trsvcid=4420") + client.succeed("nvme connect-all --transport=tcp --traddr=server --trsvcid=4420") + + with subtest("Write to the connected subsystem"): + devices = json.loads(client.succeed("lsblk --nvme --paths --json"))["blockdevices"] + assert len(devices) == 1 + client.succeed(f"dd if=/dev/zero of={devices[0]['name']} bs=1M count=64") + ''; +}) diff --git a/nixos/tests/zigbee2mqtt.nix b/nixos/tests/zigbee2mqtt.nix index 1a40d175df83..9d6d03a4b9bb 100644 --- a/nixos/tests/zigbee2mqtt.nix +++ b/nixos/tests/zigbee2mqtt.nix @@ -3,6 +3,15 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: name = "zigbee2mqtt"; nodes.machine = { pkgs, ... }: { + systemd.services.dummy-serial = { + wantedBy = [ + "multi-user.target" + ]; + serviceConfig = { + ExecStart = "${pkgs.socat}/bin/socat pty,link=/dev/ttyACM0,mode=666 pty,link=/dev/ttyACM1"; + }; + }; + services.zigbee2mqtt = { enable = true; }; @@ -11,10 +20,10 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: }; testScript = '' - machine.wait_for_unit("zigbee2mqtt.service") + machine.wait_for_unit("multi-user.target") machine.wait_until_fails("systemctl status zigbee2mqtt.service") machine.succeed( - "journalctl -eu zigbee2mqtt | grep \"Error: Error while opening serialport 'Error: Error: No such file or directory, cannot open /dev/ttyACM0'\"" + "journalctl -eu zigbee2mqtt | grep 'Failed to connect to the adapter'" ) machine.log(machine.succeed("systemd-analyze security zigbee2mqtt.service")) |