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')
|
preCheckHooks+=(postgresqlStart)
|
||||||
postCheckHooks+=('postgresqlStop')
|
postCheckHooks+=(postgresqlStop)
|
||||||
|
|
||||||
|
|
||||||
postgresqlStart() {
|
postgresqlStart() {
|
||||||
|
@ -69,6 +69,7 @@ EOF
|
||||||
|
|
||||||
echo 'starting postgresql'
|
echo 'starting postgresql'
|
||||||
eval "${postgresqlStartCommands:-pg_ctl start}"
|
eval "${postgresqlStartCommands:-pg_ctl start}"
|
||||||
|
failureHooks+=(postgresqlStop)
|
||||||
|
|
||||||
echo 'setting up postgresql'
|
echo 'setting up postgresql'
|
||||||
eval "$postgresqlTestSetupCommands"
|
eval "$postgresqlTestSetupCommands"
|
||||||
|
@ -80,4 +81,5 @@ EOF
|
||||||
postgresqlStop() {
|
postgresqlStop() {
|
||||||
echo 'stopping postgresql'
|
echo 'stopping postgresql'
|
||||||
pg_ctl stop
|
pg_ctl stop
|
||||||
|
failureHooks=("${failureHooks[@]/postgresqlStop}")
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,6 @@ postgresqlBuildExtension (finalAttrs: {
|
||||||
SELECT * FROM finish();
|
SELECT * FROM finish();
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
'';
|
'';
|
||||||
failureHook = "postgresqlStop";
|
|
||||||
checkPhase = ''
|
checkPhase = ''
|
||||||
runHook preCheck
|
runHook preCheck
|
||||||
psql -a -v ON_ERROR_STOP=1 -f $sqlPath
|
psql -a -v ON_ERROR_STOP=1 -f $sqlPath
|
||||||
|
|
|
@ -92,7 +92,6 @@ postgresqlBuildExtension (finalAttrs: {
|
||||||
];
|
];
|
||||||
|
|
||||||
postgresqlTestUserOptions = "LOGIN SUPERUSER";
|
postgresqlTestUserOptions = "LOGIN SUPERUSER";
|
||||||
failureHook = "postgresqlStop";
|
|
||||||
|
|
||||||
# postgis config directory assumes /include /lib from the same root for json-c library
|
# postgis config directory assumes /include /lib from the same root for json-c library
|
||||||
env.NIX_LDFLAGS = "-L${lib.getLib json_c}/lib";
|
env.NIX_LDFLAGS = "-L${lib.getLib json_c}/lib";
|
||||||
|
|
|
@ -21,7 +21,6 @@ stdenvNoCC.mkDerivation (
|
||||||
postgresqlTestHook
|
postgresqlTestHook
|
||||||
(postgresql.withPackages (ps: [ finalPackage ] ++ (map (p: ps."${p}") withPackages)))
|
(postgresql.withPackages (ps: [ finalPackage ] ++ (map (p: ps."${p}") withPackages)))
|
||||||
];
|
];
|
||||||
failureHook = "postgresqlStop";
|
|
||||||
postgresqlTestUserOptions = "LOGIN SUPERUSER";
|
postgresqlTestUserOptions = "LOGIN SUPERUSER";
|
||||||
passAsFile = [ "sql" ];
|
passAsFile = [ "sql" ];
|
||||||
sql =
|
sql =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue