From 87e1134406989ce4ce68fe9d7289ef9564a2b58a Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Fri, 15 Aug 2025 12:24:15 +0200 Subject: [PATCH] postgresql.tests.postgresql.postgresql-backup-all: fix random dump The new `\restrict` migitation creates random keys in the dump file by default, which breaks a before/after test for the backup module. By making the restrict key reproducible, the test passes again. --- nixos/modules/services/backup/postgresql-backup.nix | 7 ++----- nixos/tests/postgresql/postgresql.nix | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/nixos/modules/services/backup/postgresql-backup.nix b/nixos/modules/services/backup/postgresql-backup.nix index b32c0bbc5252..2e78cfa5e6d1 100644 --- a/nixos/modules/services/backup/postgresql-backup.nix +++ b/nixos/modules/services/backup/postgresql-backup.nix @@ -124,10 +124,7 @@ in type = lib.types.separatedString " "; default = "-C"; description = '' - Command line options for pg_dump. This options is not used - if `config.services.postgresqlBackup.backupAll` is enabled. - Note that config.services.postgresqlBackup.backupAll is also active, - when no databases where specified. + Command line options for pg_dump or pg_dumpall. ''; }; @@ -177,7 +174,7 @@ in ]; }) (lib.mkIf (cfg.enable && cfg.backupAll) { - systemd.services.postgresqlBackup = postgresqlBackupService "all" "pg_dumpall"; + systemd.services.postgresqlBackup = postgresqlBackupService "all" "pg_dumpall ${cfg.pgdumpOptions}"; }) (lib.mkIf (cfg.enable && !cfg.backupAll) { systemd.services = lib.listToAttrs ( diff --git a/nixos/tests/postgresql/postgresql.nix b/nixos/tests/postgresql/postgresql.nix index 456cacb54830..a1ea9b8a9028 100644 --- a/nixos/tests/postgresql/postgresql.nix +++ b/nixos/tests/postgresql/postgresql.nix @@ -65,6 +65,7 @@ let services.postgresqlBackup = { enable = true; databases = lib.optional (!backupAll) "postgres"; + pgdumpOptions = "--restrict-key=ABCDEFGHIJKLMNOPQRSTUVWXYZ"; }; };