Changed pgadmin to web-app-pgadmin

This commit is contained in:
2025-07-21 10:36:51 +02:00
parent f3aa7625fe
commit 7e58b825ea
4 changed files with 19 additions and 11 deletions

View File

@@ -1,7 +1,6 @@
import os
import unittest
import yaml
import warnings
# Dynamically determine the path to the roles directory
ROLES_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'roles'))
@@ -10,7 +9,10 @@ class TestApplicationIdDeprecation(unittest.TestCase):
def test_application_id_matches_role_name(self):
"""
Deprecation: application_id in vars/main.yml must match the role name.
This test fails if any role violates this rule, listing all violations.
"""
errors = []
for role in os.listdir(ROLES_DIR):
role_path = os.path.join(ROLES_DIR, role)
vars_main_yml = os.path.join(role_path, 'vars', 'main.yml')
@@ -20,17 +22,23 @@ class TestApplicationIdDeprecation(unittest.TestCase):
try:
data = yaml.safe_load(f)
except Exception as e:
self.fail(f"Could not parse {vars_main_yml}: {e}")
errors.append(f"Could not parse {vars_main_yml}: {e}")
continue
if not isinstance(data, dict):
continue
app_id = data.get('application_id')
if app_id is not None and app_id != role:
warnings.warn(
f"[DEPRECATION WARNING] application_id '{app_id}' in {vars_main_yml} "
f"does not match its role directory '{role}'.\n"
f"Please update 'application_id' to match the role name for future compatibility.",
DeprecationWarning
errors.append(
f"[DEPRECATION] application_id '{app_id}' in {vars_main_yml} "
f"does not match its role directory '{role}'."
)
if errors:
self.fail(
"application_id mismatch found in one or more roles:\n\n" +
"\n".join(errors) +
"\n\nPlease update 'application_id' to match the role name for future compatibility."
)
if __name__ == "__main__":
unittest.main()