tests/nvidia-container-toolkit: mv shared config to defaults

This commit is contained in:
Someone Serge 2024-08-22 17:51:54 +00:00
parent d970b4d6cd
commit f72b7b56fb
2 changed files with 141 additions and 168 deletions

View File

@ -699,7 +699,7 @@ in {
ntfy-sh = handleTest ./ntfy-sh.nix {};
ntfy-sh-migration = handleTest ./ntfy-sh-migration.nix {};
ntpd-rs = handleTest ./ntpd-rs.nix {};
nvidia-container-toolkit = handleTest ./nvidia-container-toolkit.nix {};
nvidia-container-toolkit = runTest ./nvidia-container-toolkit.nix;
nvmetcfg = handleTest ./nvmetcfg.nix {};
nzbget = handleTest ./nzbget.nix {};
nzbhydra2 = handleTest ./nzbhydra2.nix {};

View File

@ -1,10 +1,4 @@
import ./make-test-python.nix (
{
pkgs,
lib,
system,
...
}:
{ pkgs, lib, ... }:
let
testCDIScript = pkgs.writeShellScriptBin "test-cdi" ''
die() {
@ -98,61 +92,41 @@ import ./make-test-python.nix (
meta = with lib.maintainers; {
maintainers = [ ereslibre ];
};
nodes = {
no-gpus =
defaults =
{ config, ... }:
{
environment.systemPackages = with pkgs; [ jq ];
virtualisation.diskSize = lib.mkDefault 10240;
virtualisation.containers.enable = lib.mkDefault true;
hardware = {
inherit nvidia-container-toolkit;
nvidia = {
open = true;
package = config.boot.kernelPackages.nvidiaPackages.stable.open;
};
graphics.enable = lib.mkDefault true;
};
};
nodes = {
no-gpus = {
virtualisation.containers.enable = false;
hardware.graphics.enable = false;
};
one-gpu =
{ config, pkgs, ... }:
{ pkgs, ... }:
{
virtualisation.diskSize = 10240;
environment.systemPackages = with pkgs; [
jq
podman
];
hardware = {
inherit nvidia-container-toolkit;
nvidia = {
open = true;
package = config.boot.kernelPackages.nvidiaPackages.stable.open;
};
graphics.enable = true;
};
virtualisation.containers.enable = true;
environment.systemPackages = with pkgs; [ podman ];
hardware.graphics.enable = true;
};
one-gpu-invalid-host-paths =
{ config, pkgs, ... }:
{
virtualisation.diskSize = 10240;
environment.systemPackages = with pkgs; [ jq ];
hardware = {
nvidia-container-toolkit = nvidia-container-toolkit // {
mounts = [
one-gpu-invalid-host-paths = {
hardware.nvidia-container-toolkit.mounts = [
{
hostPath = "/non-existant-path";
containerPath = "/some/path";
}
];
};
nvidia = {
open = true;
package = config.boot.kernelPackages.nvidiaPackages.stable.open;
};
graphics.enable = true;
};
virtualisation.containers.enable = true;
};
};
testScript = ''
start_all()
@ -173,4 +147,3 @@ import ./make-test-python.nix (
one_gpu_invalid_host_paths.fail("grep 'non-existant-path' /var/run/cdi/nvidia-container-toolkit.json")
'';
}
)