Loading nixos/tests/all-tests.nix +1 −0 Original line number Diff line number Diff line Loading @@ -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 {}; Loading nixos/tests/nvmetcfg.nix 0 → 100644 +43 −0 Original line number Diff line number Diff line 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") ''; }) pkgs/by-name/nv/nvmetcfg/package.nix +5 −0 Original line number Diff line number Diff line { lib , rustPlatform , fetchFromGitHub , nixosTests }: rustPlatform.buildRustPackage rec { Loading @@ -16,6 +17,10 @@ rustPlatform.buildRustPackage rec { cargoHash = "sha256-yZ4UAx95f/cjeObBtzpiYtwDjgOgkKnD64yGe6ouVGw="; passthru.tests = { inherit (nixosTests) nvmetcfg; }; meta = with lib; { description = "NVMe-oF Target Configuration Utility for Linux"; homepage = "https://github.com/vifino/nvmetcfg"; Loading Loading
nixos/tests/all-tests.nix +1 −0 Original line number Diff line number Diff line Loading @@ -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 {}; Loading
nixos/tests/nvmetcfg.nix 0 → 100644 +43 −0 Original line number Diff line number Diff line 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") ''; })
pkgs/by-name/nv/nvmetcfg/package.nix +5 −0 Original line number Diff line number Diff line { lib , rustPlatform , fetchFromGitHub , nixosTests }: rustPlatform.buildRustPackage rec { Loading @@ -16,6 +17,10 @@ rustPlatform.buildRustPackage rec { cargoHash = "sha256-yZ4UAx95f/cjeObBtzpiYtwDjgOgkKnD64yGe6ouVGw="; passthru.tests = { inherit (nixosTests) nvmetcfg; }; meta = with lib; { description = "NVMe-oF Target Configuration Utility for Linux"; homepage = "https://github.com/vifino/nvmetcfg"; Loading