Skip to content

Commit 413e268

Browse files
committed
fix(tests): handle list-type shared_preload_libraries in pg_upgrade
When extensions define shared_preload_libraries as a list (e.g., pg_cron, pg_net), the test code needs to convert it to a comma-separated string for use in pg_upgrade --old-options and --new-options flags. This fix adds proper list-to-string conversion using lib.concatStringsSep.
1 parent 58e4da9 commit 413e268

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

nix/ext/tests/default.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,14 @@ let
129129
${newPostgresql}/bin/pg_upgrade --old-datadir "${oldDataDir}" --new-datadir "${newDataDir}" \
130130
--old-bindir "${oldPostgresql}/bin" --new-bindir "${newPostgresql}/bin" \
131131
${
132+
let
133+
oldLibs = oldSettings.shared_preload_libraries or "";
134+
newLibs = newSettings.shared_preload_libraries or "";
135+
oldLibsStr = if builtins.isList oldLibs then lib.concatStringsSep "," oldLibs else oldLibs;
136+
newLibsStr = if builtins.isList newLibs then lib.concatStringsSep "," newLibs else newLibs;
137+
in
132138
if oldSettings ? shared_preload_libraries || newSettings ? shared_preload_libraries then
133-
" --old-options='-c shared_preload_libraries=${oldSettings.shared_preload_libraries or ""}' --new-options='-c shared_preload_libraries=${newSettings.shared_preload_libraries or ""}'"
139+
" --old-options='-c shared_preload_libraries=${oldLibsStr}' --new-options='-c shared_preload_libraries=${newLibsStr}'"
134140
else
135141
""
136142
}

nix/ext/tests/pgmq.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,14 @@ pkgs.testers.runNixOSTest {
104104
${newPostgresql}/bin/pg_upgrade --old-datadir "${oldDataDir}" --new-datadir "${newDataDir}" \
105105
--old-bindir "${oldPostgresql}/bin" --new-bindir "${newPostgresql}/bin" \
106106
${
107+
let
108+
oldLibs = oldSettings.shared_preload_libraries or "";
109+
newLibs = newSettings.shared_preload_libraries or "";
110+
oldLibsStr = if builtins.isList oldLibs then lib.concatStringsSep "," oldLibs else oldLibs;
111+
newLibsStr = if builtins.isList newLibs then lib.concatStringsSep "," newLibs else newLibs;
112+
in
107113
if oldSettings ? shared_preload_libraries || newSettings ? shared_preload_libraries then
108-
" --old-options='-c shared_preload_libraries=${oldSettings.shared_preload_libraries or ""}' --new-options='-c shared_preload_libraries=${newSettings.shared_preload_libraries or ""}'"
114+
" --old-options='-c shared_preload_libraries=${oldLibsStr}' --new-options='-c shared_preload_libraries=${newLibsStr}'"
109115
else
110116
""
111117
}

0 commit comments

Comments
 (0)