mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
postgresqlTestHook: shutdown on failure
Previously, the user of postgresqlTestHook would have needed to set failureHook accordingly. However, this was not a clean solution, because postgresqlStop would also run for configure or build failures, before the server was even started. This gave odd errors from a failed shutdown in the log. Now postgresqlStop is only called when it makes sense - and whenever postgresqlTestHook is used.
This commit is contained in:
parent
1cf2d6085b
commit
065fefd975
4 changed files with 4 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
preCheckHooks+=('postgresqlStart')
|
||||
postCheckHooks+=('postgresqlStop')
|
||||
preCheckHooks+=(postgresqlStart)
|
||||
postCheckHooks+=(postgresqlStop)
|
||||
|
||||
|
||||
postgresqlStart() {
|
||||
|
@ -69,6 +69,7 @@ EOF
|
|||
|
||||
echo 'starting postgresql'
|
||||
eval "${postgresqlStartCommands:-pg_ctl start}"
|
||||
failureHooks+=(postgresqlStop)
|
||||
|
||||
echo 'setting up postgresql'
|
||||
eval "$postgresqlTestSetupCommands"
|
||||
|
@ -80,4 +81,5 @@ EOF
|
|||
postgresqlStop() {
|
||||
echo 'stopping postgresql'
|
||||
pg_ctl stop
|
||||
failureHooks=("${failureHooks[@]/postgresqlStop}")
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ postgresqlBuildExtension (finalAttrs: {
|
|||
SELECT * FROM finish();
|
||||
ROLLBACK;
|
||||
'';
|
||||
failureHook = "postgresqlStop";
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
psql -a -v ON_ERROR_STOP=1 -f $sqlPath
|
||||
|
|
|
@ -92,7 +92,6 @@ postgresqlBuildExtension (finalAttrs: {
|
|||
];
|
||||
|
||||
postgresqlTestUserOptions = "LOGIN SUPERUSER";
|
||||
failureHook = "postgresqlStop";
|
||||
|
||||
# postgis config directory assumes /include /lib from the same root for json-c library
|
||||
env.NIX_LDFLAGS = "-L${lib.getLib json_c}/lib";
|
||||
|
|
|
@ -21,7 +21,6 @@ stdenvNoCC.mkDerivation (
|
|||
postgresqlTestHook
|
||||
(postgresql.withPackages (ps: [ finalPackage ] ++ (map (p: ps."${p}") withPackages)))
|
||||
];
|
||||
failureHook = "postgresqlStop";
|
||||
postgresqlTestUserOptions = "LOGIN SUPERUSER";
|
||||
passAsFile = [ "sql" ];
|
||||
sql =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue