diff options
author | Franz Pletz <fpletz@fnordicwalking.de> | 2018-12-18 01:03:34 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-18 01:03:34 +0000 |
commit | 670c5ac8ef2e1c6ad74af7d035e072afcd431aad (patch) | |
tree | 51944650274bd4c0b059689fc403fead5fdb2b0b /nixos | |
parent | b72dc8c2f209d72455802d52852207d4e0f14752 (diff) | |
parent | 113a6b9325b92d483e6c2f12c35c2887ab175a8d (diff) |
Merge pull request #46806 from Ma27/disallow-dash-separators-in-machine-declarations
nixos/testing: disallow special chars in machine names in network expressions
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/lib/testing.nix | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/nixos/lib/testing.nix b/nixos/lib/testing.nix index 0bb3fd53e853b..96a42c2f30583 100644 --- a/nixos/lib/testing.nix +++ b/nixos/lib/testing.nix @@ -156,9 +156,23 @@ in rec { test = passMeta (runTests driver); report = passMeta (releaseTools.gcovReport { coverageRuns = [ test ]; }); - in (if makeCoverageReport then report else test) // { - inherit nodes driver test; - }; + nodeNames = builtins.attrNames nodes; + invalidNodeNames = lib.filter + (node: builtins.match "^[A-z_][A-z0-9_]+$" node == null) nodeNames; + + in + if lib.length invalidNodeNames > 0 then + throw '' + Cannot create machines out of (${lib.concatStringsSep ", " invalidNodeNames})! + All machines are references as perl variables in the testing framework which will break the + script when special characters are allowed. + + Please stick to alphanumeric chars and underscores as separation. + '' + else + (if makeCoverageReport then report else test) // { + inherit nodes driver test; + }; runInMachine = { drv |