postgresqlTestHook: shutdown on failure (#389938)

This commit is contained in:
Wolfgang Walther 2025-05-11 10:17:30 +00:00 committed by GitHub
commit 2d6c5c54c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
50 changed files with 7 additions and 54 deletions

View file

@ -251,6 +251,7 @@ pkgs/development/python-modules/buildcatrust/ @ajs124 @lukegb @mweinelt
/maintainers/scripts/kde @K900 @NickCao @SuperSandro2000 @ttuegel
# PostgreSQL and related stuff
/pkgs/by-name/po/postgresqlTestHook @NixOS/postgres
/pkgs/by-name/ps/psqlodbc @NixOS/postgres
/pkgs/servers/sql/postgresql @NixOS/postgres
/pkgs/development/tools/rust/cargo-pgrx @NixOS/postgres

View file

@ -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}")
}

View file

@ -7,10 +7,9 @@
postgresql,
postgresqlBuildExtension,
runtimeShell,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
postgresqlBuildExtension {
pname = "postgresql_anonymizer";
inherit (pg-dump-anon) version src;
@ -32,4 +31,4 @@ postgresqlBuildExtension (finalAttrs: {
meta = lib.getAttrs [ "homepage" "teams" "license" ] pg-dump-anon.meta // {
description = "Extension to mask or replace personally identifiable information (PII) or commercially sensitive data from a PostgreSQL database";
};
})
}

View file

@ -5,7 +5,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
}:
let

View file

@ -7,7 +7,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -4,7 +4,6 @@
postgresql,
postgresqlBuildExtension,
protobufc,
stdenv,
}:
postgresqlBuildExtension {

View file

@ -4,7 +4,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension {

View file

@ -6,7 +6,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -4,7 +4,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
testers,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
let

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -6,7 +6,6 @@
pkg-config,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -4,7 +4,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -5,7 +5,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
testers,
}:

View file

@ -3,8 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
postgresqlTestHook,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
with {

View file

@ -4,7 +4,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension {

View file

@ -5,7 +5,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension rec {

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -5,7 +5,6 @@
openssl,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
let

View file

@ -5,7 +5,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
unstableGitUpdater,
}:

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -6,7 +6,6 @@
pkg-config,
postgresql,
postgresqlBuildExtension,
stdenv,
xxHash,
}:

View file

@ -6,7 +6,6 @@
perl,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -6,7 +6,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -4,7 +4,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -45,7 +45,6 @@ postgresqlBuildExtension (finalAttrs: {
SELECT * FROM finish();
ROLLBACK;
'';
failureHook = "postgresqlStop";
checkPhase = ''
runHook preCheck
psql -a -v ON_ERROR_STOP=1 -f $sqlPath

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -4,7 +4,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -8,7 +8,6 @@
postgresqlTestExtension,
R,
rPackages,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlTestExtension,
tcl,
tclPackages,
}:

View file

@ -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";

View file

@ -6,7 +6,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -4,7 +4,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension {

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
pname = "system_stats";

View file

@ -4,8 +4,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
unstableGitUpdater,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {

View file

@ -7,7 +7,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
enableUnfree ? true,
}:

View file

@ -5,7 +5,6 @@ let
{
stdenv,
fetchFromGitHub,
fetchpatch,
fetchurl,
lib,
replaceVars,

View file

@ -21,7 +21,6 @@ stdenvNoCC.mkDerivation (
postgresqlTestHook
(postgresql.withPackages (ps: [ finalPackage ] ++ (map (p: ps."${p}") withPackages)))
];
failureHook = "postgresqlStop";
postgresqlTestUserOptions = "LOGIN SUPERUSER";
passAsFile = [ "sql" ];
sql =