postgresqlTestHook: shutdown on failure (#389938)

This commit is contained in:
Wolfgang Walther
2025-05-11 10:17:30 +00:00
committed by GitHub
50 changed files with 7 additions and 54 deletions
+1
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
@@ -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}")
}
@@ -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";
};
})
}
@@ -5,7 +5,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
}:
let
@@ -7,7 +7,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -4,7 +4,6 @@
postgresql,
postgresqlBuildExtension,
protobufc,
stdenv,
}:
postgresqlBuildExtension {
@@ -4,7 +4,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension {
@@ -6,7 +6,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -4,7 +4,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
testers,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
let
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -6,7 +6,6 @@
pkg-config,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -4,7 +4,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -5,7 +5,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
testers,
}:
@@ -3,8 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
postgresqlTestHook,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
with {
@@ -4,7 +4,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension {
@@ -5,7 +5,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension rec {
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -5,7 +5,6 @@
openssl,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
let
@@ -5,7 +5,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
unstableGitUpdater,
}:
-1
View File
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -6,7 +6,6 @@
pkg-config,
postgresql,
postgresqlBuildExtension,
stdenv,
xxHash,
}:
@@ -6,7 +6,6 @@
perl,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -6,7 +6,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -4,7 +4,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -45,7 +45,6 @@ postgresqlBuildExtension (finalAttrs: {
SELECT * FROM finish();
ROLLBACK;
'';
failureHook = "postgresqlStop";
checkPhase = ''
runHook preCheck
psql -a -v ON_ERROR_STOP=1 -f $sqlPath
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -4,7 +4,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
-1
View File
@@ -8,7 +8,6 @@
postgresqlTestExtension,
R,
rPackages,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlTestExtension,
tcl,
tclPackages,
}:
@@ -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";
@@ -6,7 +6,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
-1
View File
@@ -4,7 +4,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension {
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
pname = "system_stats";
@@ -4,8 +4,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
unstableGitUpdater,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -3,7 +3,6 @@
lib,
postgresql,
postgresqlBuildExtension,
stdenv,
}:
postgresqlBuildExtension (finalAttrs: {
@@ -7,7 +7,6 @@
postgresql,
postgresqlBuildExtension,
postgresqlTestExtension,
stdenv,
enableUnfree ? true,
}:
-1
View File
@@ -5,7 +5,6 @@ let
{
stdenv,
fetchFromGitHub,
fetchpatch,
fetchurl,
lib,
replaceVars,
@@ -21,7 +21,6 @@ stdenvNoCC.mkDerivation (
postgresqlTestHook
(postgresql.withPackages (ps: [ finalPackage ] ++ (map (p: ps."${p}") withPackages)))
];
failureHook = "postgresqlStop";
postgresqlTestUserOptions = "LOGIN SUPERUSER";
passAsFile = [ "sql" ];
sql =