Skip to content

Commit a1f5767

Browse files
committed
tests: kludge for testgres, which currently does not support PG13
1 parent 5fb5234 commit a1f5767

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/helpers/ptrack_helpers.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,13 @@ def make_simple_node(
382382
# Apply given parameters
383383
self.set_auto_conf(node, pg_options)
384384

385+
# kludge for testgres
386+
# https://github.com/postgrespro/testgres/issues/54
387+
# for PG >= 13 remove 'wal_keep_segments' parameter
388+
if node.major_version >= 13:
389+
self.set_auto_conf(
390+
node, {}, 'postgresql.conf', ['wal_keep_segments'])
391+
385392
return node
386393

387394
def create_tblspace_in_node(self, node, tblspc_name, tblspc_path=None, cfs=False):
@@ -1231,7 +1238,9 @@ def get_restore_command(self, backup_dir, instance, node):
12311238

12321239
return restore_command
12331240

1234-
def set_auto_conf(self, node, options, config='postgresql.auto.conf'):
1241+
# rm_options - list of parameter name that should be deleted from current config,
1242+
# example: ['wal_keep_segments', 'max_wal_size']
1243+
def set_auto_conf(self, node, options, config='postgresql.auto.conf', rm_options={}):
12351244

12361245
# parse postgresql.auto.conf
12371246
path = os.path.join(node.data_dir, config)
@@ -1259,6 +1268,11 @@ def set_auto_conf(self, node, options, config='postgresql.auto.conf'):
12591268
var = var.strip()
12601269
var = var.strip('"')
12611270
var = var.strip("'")
1271+
1272+
# remove options specified in rm_options list
1273+
if name in rm_options:
1274+
continue
1275+
12621276
current_options[name] = var
12631277

12641278
for option in options:

0 commit comments

Comments
 (0)