fix: ensure e2e tests are collected in order

This commit is contained in:
David Arnold 2021-06-01 10:28:53 -05:00
parent 806a3d759e
commit a0ce293db8
No known key found for this signature in database
GPG key ID: 6D6A936E69C59D08

View file

@ -22,13 +22,25 @@ let
'' ''
else t.script; else t.script;
tests = pkgs.linkFarm "${testing.name}-tests" ( tests = let
map # make sure tests are prefixed so that alphanumerical
(t: { # sorting reproduces them in the same order as they
path = toTestScript t; # have been declared in the list.
name = "${t.name}_test.py"; seive = t: t.script != null && t.enabled;
}) allEligibleTests = filter seive testing.tests;
(filter (t: t.script != null) testing.tests) listLengthPadding = builtins.length (
lib.stringToCharacters (
builtins.toString (
builtins.length allEligibleTests)));
op =
(i: t: {
path = toTestScript t;
name = let
prefix = lib.fixedWidthNumber listLengthPadding i;
in "${prefix}_${t.name}_test.py";
});
in pkgs.linkFarm "${testing.name}-tests" (
lib.imap0 op allEligibleTests;
); );
testScript = pkgs.writeScript "test-${testing.name}.sh" '' testScript = pkgs.writeScript "test-${testing.name}.sh" ''