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 <tazjin@tvl.su>
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
Vincent Ambo 2022-05-28 00:58:05 +02:00 committed by clbot
parent deb8796cc5
commit 1c6dc510a6

View file

@ -2,6 +2,14 @@
# creating an ARGON2 password hash. # creating an ARGON2 password hash.
{ pkgs, ... }: { pkgs, ... }:
pkgs.writeShellScriptBin "hash-password" '' let
${pkgs.openldap}/bin/slappasswd -o module-load=pw-argon2 -h '{ARGON2}' 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
'';
})