Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions web/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,13 +540,15 @@
"pg-16": "",
"pg-17": "",
"pg-18": "",
"pg-19": "",
"ppas": "",
"ppas-13": "",
"ppas-14": "",
"ppas-15": "",
"ppas-16": "",
"ppas-17": "",
"ppas-18": ""
"ppas-18": "",
"ppas-19": ""
}

##########################################################################
Expand All @@ -562,13 +564,15 @@
"pg-16": "",
"pg-17": "",
"pg-18": "",
"pg-19": "",
"ppas": "",
"ppas-13": "",
"ppas-14": "",
"ppas-15": "",
"ppas-16": "",
"ppas-17": "",
"ppas-18": ""
"ppas-18": "",
"ppas-19": ""
}

##########################################################################
Expand Down
6 changes: 6 additions & 0 deletions web/pgadmin/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@
"isDefault": False},
{"version": "180000", "next_major_version": "190000",
"serverType": gettext("EDB Advanced Server 18"), "binaryPath": None,
"isDefault": False},
{"version": "190000", "next_major_version": "200000",
"serverType": gettext("EDB Advanced Server 19"), "binaryPath": None,
"isDefault": False}
],
"pg_bin_paths": [
Expand All @@ -119,6 +122,9 @@
"isDefault": False},
{"version": "180000", "next_major_version": "190000",
"serverType": gettext("PostgreSQL 18"), "binaryPath": None,
"isDefault": False},
{"version": "190000", "next_major_version": "200000",
"serverType": gettext("PostgreSQL 19"), "binaryPath": None,
"isDefault": False}
]
}
Expand Down
60 changes: 60 additions & 0 deletions web/pgadmin/utils/tests/test_binary_path_versions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2026, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################

"""Check that the binary path settings cover every supported major version.

Each major version needs a row in BINARY_PATHS (which builds the grids
under Preferences > Paths > Binary paths) and a matching "pg-N" or
"ppas-N" key in config.DEFAULT_BINARY_PATHS and config.FIXED_BINARY_PATHS.
Adding a version in one place and not the others leaves it impossible to
configure, so these tests compare the lists against each other.
"""

import config
from pgadmin.utils.constants import BINARY_PATHS
from pgadmin.utils.route import BaseTestGenerator

# The newest major version pgAdmin offers a binary path for.
LATEST_SUPPORTED_MAJOR = 19


class BinaryPathVersionsTestCase(BaseTestGenerator):
"""BINARY_PATHS and the config dictionaries must agree."""

scenarios = [
('PostgreSQL', dict(paths_key='pg_bin_paths', config_prefix='pg',
label='PostgreSQL')),
('EDB Advanced Server', dict(paths_key='as_bin_paths',
config_prefix='ppas',
label='EDB Advanced Server')),
]

def runTest(self):
entries = BINARY_PATHS[self.paths_key]
majors = [int(e['version']) // 10000 for e in entries]

self.assertEqual(majors[-1], LATEST_SUPPORTED_MAJOR)
self.assertEqual(majors,
list(range(majors[0], LATEST_SUPPORTED_MAJOR + 1)))

for major, entry in zip(majors, entries):
self.assertEqual(entry['version'], str(major * 10000))
self.assertEqual(entry['next_major_version'],
str((major + 1) * 10000))
self.assertEqual(entry['serverType'],
'{0} {1}'.format(self.label, major))

expected_keys = {self.config_prefix} | {
'{0}-{1}'.format(self.config_prefix, major) for major in majors
}
for name in ('DEFAULT_BINARY_PATHS', 'FIXED_BINARY_PATHS'):
keys = {k for k in getattr(config, name)
if k == self.config_prefix or
k.startswith(self.config_prefix + '-')}
self.assertEqual(keys, expected_keys, name)
Loading