My personal project and infrastructure archive
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nomicon/pkgs/build-support/setup-hooks/postgresql-test-hook/test.nix

27 lines
569 B

{ postgresql, postgresqlTestHook, stdenv }:
stdenv.mkDerivation {
name = "postgresql-test-hook-test";
buildInputs = [ postgresqlTestHook ];
checkInputs = [ postgresql ];
dontUnpack = true;
doCheck = true;
passAsFile = ["sql"];
sql = ''
CREATE TABLE hello (
message text
);
INSERT INTO hello VALUES ('it '||'worked');
SELECT * FROM hello;
'';
checkPhase = ''
runHook preCheck
psql <$sqlPath | grep 'it worked'
TEST_RAN=1
runHook postCheck
'';
installPhase = ''
[[ $TEST_RAN == 1 ]]
touch $out
'';
}