Skip to content

Commit

Permalink
[6.15.z] Add a configurable wait period for shared resource (#17464) (#…
Browse files Browse the repository at this point in the history
…17600)

Add a configurable wait period for shared resource (#17464)

Add a configurable wat period for shared resource

It would be beneficial to drop this lower for tests.

(cherry picked from commit 1995f76)

Co-authored-by: Jake Callahan <[email protected]>
  • Loading branch information
ogajduse and JacobCallahan authored Feb 14, 2025
1 parent 3a83c1c commit 718204c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions conf/robottelo.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ ROBOTTELO:
SETTINGS:
GET_FRESH: true
IGNORE_VALIDATION_ERRORS: false
SHARED_RESOURCE_WAIT: 2
3 changes: 2 additions & 1 deletion robottelo/config/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,14 @@
],
robottelo=[
Validator('robottelo.settings.ignore_validation_errors', is_type_of=bool, default=False),
Validator('robottelo.rhel_source', default='ga', is_in=['ga', 'internal']),
Validator(
'robottelo.sat_non_ga_versions',
is_type_of=list,
default=[],
cast=lambda x: list(map(str, x)),
),
Validator('robottelo.rhel_source', default='ga', is_in=['ga', 'internal']),
Validator('robottelo.shared_resource_wait', default=60, cast=float),
],
shared_function=[
Validator('shared_function.storage', is_in=('file', 'redis'), default='file'),
Expand Down
4 changes: 3 additions & 1 deletion robottelo/utils/shared_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

from broker.helpers import FileLock

from robottelo.config import settings


class SharedResourceError(Exception):
"""An exception class for SharedResource errors."""
Expand Down Expand Up @@ -120,7 +122,7 @@ def _wait_for_main_watcher(self):
while True:
curr_data = json.loads(self.resource_file.read_text())
if curr_data["main_status"] != "done":
time.sleep(60)
time.sleep(settings.robottelo.shared_resource_wait)
elif curr_data["main_status"] == "action_error":
self._try_take_over()
elif curr_data["main_status"] == "error":
Expand Down

0 comments on commit 718204c

Please sign in to comment.