From 1c6dc510a6136defcef997697a7a6eda498e9930 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 28 May 2022 00:58:05 +0200 Subject: [PATCH] test(tools/hash-password): ensure that script can execute correctly This tests loading of the argon2 OpenLDAP module. Relates to b/184 Change-Id: I661af4ddc238ad02d082b3a0cede55af5ef13f1b Reviewed-on: https://cl.tvl.fyi/c/depot/+/5750 Tested-by: BuildkiteCI Autosubmit: tazjin Reviewed-by: sterni --- tools/hash-password.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/hash-password.nix b/tools/hash-password.nix index 9893d5217..6192436c1 100644 --- a/tools/hash-password.nix +++ b/tools/hash-password.nix @@ -2,6 +2,14 @@ # creating an ARGON2 password hash. { pkgs, ... }: -pkgs.writeShellScriptBin "hash-password" '' - ${pkgs.openldap}/bin/slappasswd -o module-load=pw-argon2 -h '{ARGON2}' -'' +let + script = pkgs.writeShellScriptBin "hash-password" '' + ${pkgs.openldap}/bin/slappasswd -o module-load=argon2 -h '{ARGON2}' "$@" + ''; +in +script.overrideAttrs (old: { + doCheck = true; + checkPhase = '' + ${pkgs.stdenv.shell} $out/bin/hash-password -s example-password > /dev/null + ''; +})