tests.overriding: structure tests as an attribut set

Make individual tests accessible via tests.override.tests.<name>
This commit is contained in:
Yueh-Shun Li 2024-07-26 03:07:48 +08:00
parent 9e1f27272a
commit fdd16729a2
2 changed files with 15 additions and 17 deletions

View File

@ -134,6 +134,8 @@
Refer to upstream [upgrade instructions](https://goteleport.com/docs/management/operations/upgrading/) Refer to upstream [upgrade instructions](https://goteleport.com/docs/management/operations/upgrading/)
and [release notes for v16](https://goteleport.com/docs/changelog/#1600-061324). and [release notes for v16](https://goteleport.com/docs/changelog/#1600-061324).
- `tests.overriding` has its `passthru.tests` restructured as an attribute set instead of a list, making individual tests accessible by their names.
- `vaultwarden` lost the capability to bind to privileged ports. If you rely on - `vaultwarden` lost the capability to bind to privileged ports. If you rely on
this behavior, override the systemd unit to allow `CAP_NET_BIND_SERVICE` in this behavior, override the systemd unit to allow `CAP_NET_BIND_SERVICE` in
your local configuration. your local configuration.

View File

@ -5,33 +5,29 @@ let
let let
p = pkgs.python3Packages.xpybutil.overridePythonAttrs (_: { dontWrapPythonPrograms = true; }); p = pkgs.python3Packages.xpybutil.overridePythonAttrs (_: { dontWrapPythonPrograms = true; });
in in
[ {
({ overridePythonAttrs = {
name = "overridePythonAttrs";
expr = !lib.hasInfix "wrapPythonPrograms" p.postFixup; expr = !lib.hasInfix "wrapPythonPrograms" p.postFixup;
expected = true; expected = true;
}) };
({ repeatedOverrides-pname = {
name = "repeatedOverrides-pname";
expr = repeatedOverrides.pname == "a-better-hello-with-blackjack"; expr = repeatedOverrides.pname == "a-better-hello-with-blackjack";
expected = true; expected = true;
}) };
({ repeatedOverrides-entangled-pname = {
name = "repeatedOverrides-entangled-pname";
expr = repeatedOverrides.entangled.pname == "a-better-figlet-with-blackjack"; expr = repeatedOverrides.entangled.pname == "a-better-figlet-with-blackjack";
expected = true; expected = true;
}) };
({ overriding-using-only-attrset = {
name = "overriding-using-only-attrset";
expr = (pkgs.hello.overrideAttrs { pname = "hello-overriden"; }).pname == "hello-overriden"; expr = (pkgs.hello.overrideAttrs { pname = "hello-overriden"; }).pname == "hello-overriden";
expected = true; expected = true;
}) };
({ overriding-using-only-attrset-no-final-attrs = {
name = "overriding-using-only-attrset-no-final-attrs"; name = "overriding-using-only-attrset-no-final-attrs";
expr = ((stdenvNoCC.mkDerivation { pname = "hello-no-final-attrs"; }).overrideAttrs { pname = "hello-no-final-attrs-overridden"; }).pname == "hello-no-final-attrs-overridden"; expr = ((stdenvNoCC.mkDerivation { pname = "hello-no-final-attrs"; }).overrideAttrs { pname = "hello-no-final-attrs-overridden"; }).pname == "hello-no-final-attrs-overridden";
expected = true; expected = true;
}) };
]; };
addEntangled = origOverrideAttrs: f: addEntangled = origOverrideAttrs: f:
origOverrideAttrs ( origOverrideAttrs (
@ -62,5 +58,5 @@ stdenvNoCC.mkDerivation {
passthru = { inherit tests; }; passthru = { inherit tests; };
buildCommand = '' buildCommand = ''
touch $out touch $out
'' + lib.concatMapStringsSep "\n" (t: "([[ ${lib.boolToString t.expr} == ${lib.boolToString t.expected} ]] && echo '${t.name} success') || (echo '${t.name} fail' && exit 1)") tests; '' + lib.concatStringsSep "\n" (lib.attrValues (lib.mapAttrs (name: t: "([[ ${lib.boolToString t.expr} == ${lib.boolToString t.expected} ]] && echo '${name} success') || (echo '${name} fail' && exit 1)") tests));
} }