Skip to content

Commit

Permalink
Increase timeout to get card to reduce test failures (#1717)
Browse files Browse the repository at this point in the history
  • Loading branch information
romain-intel authored Feb 5, 2024
1 parent 81d8909 commit 3c590d3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions test/core/metaflow_test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def truncate(var):
return var


def retry_untill_timeout(cb_fn, *args, timeout=4, **kwargs):
def retry_until_timeout(cb_fn, *args, timeout=4, **kwargs):
"""
certain operations in metaflow may not be synchronous and may be running fully asynchronously.
This creates a problem in writing tests that verify some behaviour at runtime. This function
Expand All @@ -52,7 +52,7 @@ def retry_untill_timeout(cb_fn, *args, timeout=4, **kwargs):
time.sleep(1)


def try_to_get_card(id=None, timeout=4):
def try_to_get_card(id=None, timeout=60):
"""
Safetly try to get the card object until a timeout value.
"""
Expand All @@ -63,7 +63,7 @@ def _get_card(card_id):
return False
return container[0]

return retry_untill_timeout(_get_card, id, timeout=timeout)
return retry_until_timeout(_get_card, id, timeout=timeout)


class AssertArtifactFailed(Exception):
Expand Down
2 changes: 1 addition & 1 deletion test/core/tests/card_component_refresh_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def create_random_string_array(size=10):
# The `try_to_get_card` function will keep retrying to get a card until a
# timeout value is reached. After which the function will throw a `TimeoutError`.
_reload_tok = make_reload_token(component_1_arr, component_2_arr)
card = try_to_get_card(id="refresh_card", timeout=10)
card = try_to_get_card(id="refresh_card")
assert_equals(isinstance(card, Card), True)

sleep_between_refreshes = 2 # Set based on the RUNTIME_CARD_MIN_REFRESH_INTERVAL which acts as a rate-limit to what is refreshed.
Expand Down
2 changes: 1 addition & 1 deletion test/core/tests/card_refresh_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _array_is_a_subset(arr1, arr2):
# when async processes may write cards/data in a "best-effort" manner.
# The `try_to_get_card` function will keep retrying to get a card until a
# timeout value is reached. After which the function will throw a `TimeoutError`.
card = try_to_get_card(id="refresh_card", timeout=4)
card = try_to_get_card(id="refresh_card")
assert_equals(isinstance(card, Card), True)

sleep_between_refreshes = 4 # Set based on the RUNTIME_CARD_MIN_REFRESH_INTERVAL which acts as a rate-limit to what is refreshed.
Expand Down

0 comments on commit 3c590d3

Please sign in to comment.