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 /maintainers/scripts/kde @K900 @NickCao @SuperSandro2000 @ttuegel
# PostgreSQL and related stuff # PostgreSQL and related stuff
/pkgs/by-name/po/postgresqlTestHook @NixOS/postgres
/pkgs/by-name/ps/psqlodbc @NixOS/postgres /pkgs/by-name/ps/psqlodbc @NixOS/postgres
/pkgs/servers/sql/postgresql @NixOS/postgres /pkgs/servers/sql/postgresql @NixOS/postgres
/pkgs/development/tools/rust/cargo-pgrx @NixOS/postgres /pkgs/development/tools/rust/cargo-pgrx @NixOS/postgres

View file

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

View file

@ -7,10 +7,9 @@
postgresql, postgresql,
postgresqlBuildExtension, postgresqlBuildExtension,
runtimeShell, runtimeShell,
stdenv,
}: }:
postgresqlBuildExtension (finalAttrs: { postgresqlBuildExtension {
pname = "postgresql_anonymizer"; pname = "postgresql_anonymizer";
inherit (pg-dump-anon) version src; inherit (pg-dump-anon) version src;
@ -32,4 +31,4 @@ postgresqlBuildExtension (finalAttrs: {
meta = lib.getAttrs [ "homepage" "teams" "license" ] pg-dump-anon.meta // { 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"; 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, postgresql,
postgresqlBuildExtension, postgresqlBuildExtension,
postgresqlTestExtension, postgresqlTestExtension,
stdenv,
}: }:
let let

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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 =