From 00f5ae0602cb0b82fca5916fb1b68b6b2f4ea531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 20 Mar 2026 12:23:35 +0100 Subject: [PATCH] nixos/testing: fix testScript eval for functions without `...` The nspawn container support (23f1e6370d1e) added a `containers` argument to the testScript caller. This breaks tests whose testScript uses strict pattern matching without ellipsis, e.g. `{ nodes }:`, since Nix rejects unexpected arguments. Use `builtins.intersectAttrs` to only pass arguments the function actually expects, making the caller forward-compatible with future argument additions. Fixes: 23f1e6370d1e ("nixos/test-driver: add support for nspawn containers") --- nixos/lib/testing/testScript.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nixos/lib/testing/testScript.nix b/nixos/lib/testing/testScript.nix index bde7b78607b4..fe417c4a624c 100644 --- a/nixos/lib/testing/testScript.nix +++ b/nixos/lib/testing/testScript.nix @@ -14,6 +14,13 @@ in options = { testScript = mkOption { type = either str (functionTo str); + apply = + v: + if lib.isFunction v then + # Only pass args the testScript function expects. + args: v (builtins.intersectAttrs (lib.functionArgs v) args) + else + v; description = '' A series of python declarations and statements that you write to perform the test.