Skip to content

Commit

Permalink
Enforce the Dynaconf validaton
Browse files Browse the repository at this point in the history
  • Loading branch information
ogajduse committed Jun 17, 2024
1 parent 90ffb9b commit 8c67806
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions conf/robottelo.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ ROBOTTELO:
# Dynaconf and Dynaconf hooks related options
SETTINGS:
GET_FRESH: true
SKIP_VALIDATION: false
10 changes: 6 additions & 4 deletions robottelo/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
3 changes: 3 additions & 0 deletions robottelo/config/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 8c67806

Please sign in to comment.