From 8c67806b84c6a7b1e1e61fbaf0a59159f56b55cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Gajdu=C5=A1ek?= Date: Mon, 3 Jun 2024 19:00:27 +0200 Subject: [PATCH] Enforce the Dynaconf validaton --- .github/workflows/pull_request.yml | 1 + conf/robottelo.yaml.template | 1 + robottelo/config/__init__.py | 10 ++++++---- robottelo/config/validators.py | 3 +++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 276ff267e1a..44307be22cf 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -9,6 +9,7 @@ env: PYCURL_SSL_LIBRARY: openssl ROBOTTELO_BUGZILLA__API_KEY: ${{ secrets.BUGZILLA_KEY }} ROBOTTELO_JIRA__API_KEY: ${{ secrets.JIRA_KEY }} + ROBOTTELO_ROBOTTELO__SETTINGS__SKIP_VALIDATION: true jobs: codechecks: diff --git a/conf/robottelo.yaml.template b/conf/robottelo.yaml.template index 7bf111cdc65..689c1f34fff 100644 --- a/conf/robottelo.yaml.template +++ b/conf/robottelo.yaml.template @@ -21,3 +21,4 @@ ROBOTTELO: # Dynaconf and Dynaconf hooks related options SETTINGS: GET_FRESH: true + SKIP_VALIDATION: false diff --git a/robottelo/config/__init__.py b/robottelo/config/__init__.py index d761dd06e91..8c18a4550b6 100644 --- a/robottelo/config/__init__.py +++ b/robottelo/config/__init__.py @@ -40,10 +40,12 @@ def get_settings(): try: settings.validators.validate() except ValidationError as err: - logger.warning( - f'Dynaconf validation failed, continuing for the sake of unit tests\n{err}' - ) - + if settings.robottelo.settings.get('skip_validation'): + logger.warning( + f'Dynaconf validation failed, continuing for the sake of unit tests\n{err}' + ) + else: + raise err return settings diff --git a/robottelo/config/validators.py b/robottelo/config/validators.py index 2ae4c42ac04..928df1a35b4 100644 --- a/robottelo/config/validators.py +++ b/robottelo/config/validators.py @@ -335,6 +335,9 @@ Validator('remotedb.ssl', default=True), Validator('remotedb.port', default=5432), ], + robottelo=[ + Validator('robottelo.settings.skip_validation', is_type_of=bool, default=False), + ], shared_function=[ Validator('shared_function.storage', is_in=('file', 'redis'), default='file'), Validator('shared_function.share_timeout', lte=86400, default=86400),