summary refs log tree commit diff
path: root/nixos/lib
diff options
context:
space:
mode:
authorMichael Fellinger <michael.fellinger@xing.com>2018-02-19 12:17:13 +0100
committerTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2018-02-20 16:36:16 +0200
commit0d988d6735e3afa37aba7e838bde0fd80fd34f49 (patch)
tree70371801496f7681a6bc375db4591e0f9c8846c7 /nixos/lib
parentd351cd9f6959646d9b52abf014360b7a6e8c958d (diff)
downloadnixlib-0d988d6735e3afa37aba7e838bde0fd80fd34f49.tar
nixlib-0d988d6735e3afa37aba7e838bde0fd80fd34f49.tar.gz
nixlib-0d988d6735e3afa37aba7e838bde0fd80fd34f49.tar.bz2
nixlib-0d988d6735e3afa37aba7e838bde0fd80fd34f49.tar.lz
nixlib-0d988d6735e3afa37aba7e838bde0fd80fd34f49.tar.xz
nixlib-0d988d6735e3afa37aba7e838bde0fd80fd34f49.tar.zst
nixlib-0d988d6735e3afa37aba7e838bde0fd80fd34f49.zip
Only allow test names of up to 50 characters
Diffstat (limited to 'nixos/lib')
-rw-r--r--nixos/lib/testing.nix10
1 files changed, 9 insertions, 1 deletions
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 { }));