@@ -75,9 +75,6 @@ class TimeoutConfig(IntEnum):
7575 # base amount to sleep for before beginning exponential backoff during testing
7676 BASE_SLEEP = 2
7777
78- # Max amount to wait before timing out during exponential backoff in each iteration
79- MAX_SLEEP_PER_TRY = 30
80-
8178 # NOTE: Based on testing, there are 45 detections couldn't generate risk/notables within single dispatch, and
8279 # they needed to be retried; 90s is a reasonable wait time before retrying dispatching the SavedSearch
8380 # Wait time before retrying dispatching the SavedSearch
@@ -954,7 +951,6 @@ def dispatch_and_validate(self, elapsed_sleep_time: dict[str, int]) -> None:
954951 self .dispatch ()
955952
956953 wait_time = TimeoutConfig .BASE_SLEEP
957- max_wait = TimeoutConfig .MAX_SLEEP_PER_TRY
958954 time_elapsed = 0
959955 validation_error = None
960956
@@ -968,7 +964,9 @@ def dispatch_and_validate(self, elapsed_sleep_time: dict[str, int]) -> None:
968964 if time_elapsed > TimeoutConfig .ADD_WAIT_TIME :
969965 time .sleep (wait_time )
970966 elapsed_sleep_time ["elapsed_sleep_time" ] += wait_time
971- wait_time = min (max_wait , wait_time * 2 )
967+ wait_time = min (
968+ TimeoutConfig .RETRY_DISPATCH - int (time_elapsed ), wait_time * 2
969+ )
972970
973971 try :
974972 self .validate_ara_events ()
@@ -992,7 +990,6 @@ def dispatch_and_validate(self, elapsed_sleep_time: dict[str, int]) -> None:
992990 # it for completion, but that seems more tricky
993991 def test (
994992 self ,
995- max_sleep : int = TimeoutConfig .MAX_SLEEP_PER_TRY ,
996993 raise_on_exc : bool = False ,
997994 ) -> IntegrationTestResult :
998995 """Execute the integration test
@@ -1001,17 +998,9 @@ def test(
1001998 and clear the indexes if so. Then, we force a run of the detection, wait for `sleep` seconds, and finally we
1002999 validate that the appropriate risk/notable events seem to have been created. NOTE: assumes the data already
10031000 exists in the instance
1004- :param max_sleep: max number of seconds to sleep in each iteration for after enabling the detection before we
1005- check for created events; re-checks are made upon failures using an exponential backoff until the max is reached
10061001 :param raise_on_exc: bool flag indicating if an exception should be raised when caught by the test routine, or
10071002 if the error state should just be recorded for the test
10081003 """
1009- # max_sleep must be greater than the base value
1010- if max_sleep < TimeoutConfig .BASE_SLEEP :
1011- raise ClientError (
1012- f"max_sleep value of { max_sleep } is less than the base sleep required "
1013- f"({ TimeoutConfig .BASE_SLEEP } )"
1014- )
10151004
10161005 # initialize result as None
10171006 result : IntegrationTestResult | None = None
0 commit comments