From 0d988d6735e3afa37aba7e838bde0fd80fd34f49 Mon Sep 17 00:00:00 2001 From: Michael Fellinger Date: Mon, 19 Feb 2018 12:17:13 +0100 Subject: Only allow test names of up to 50 characters --- nixos/lib/testing.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'nixos/lib/testing.nix') diff --git a/nixos/lib/testing.nix b/nixos/lib/testing.nix index ddab23cce393..05b4f752da40 100644 --- a/nixos/lib/testing.nix +++ b/nixos/lib/testing.nix @@ -78,7 +78,15 @@ rec { } @ t: let - testDriverName = "nixos-test-driver-${name}"; + maxTestNameLen = 50; + testNameLen = builtins.stringLength name; + + testDriverName = with builtins; + if testNameLen > maxTestNameLen then + abort ("The name of the test '${name}' must not be longer than ${toString maxTestNameLen} " + + "it's currently ${toString testNameLen} characters long.") + else + "nixos-test-driver-${name}"; nodes = buildVirtualNetwork ( t.nodes or (if t ? machine then { machine = t.machine; } else { })); -- cgit 1.4.1