File tree Expand file tree Collapse file tree 1 file changed +2
-12
lines changed Expand file tree Collapse file tree 1 file changed +2
-12
lines changed Original file line number Diff line number Diff line change 11from datetime import timedelta
2- import time
32from codeguru_profiler_agent .reporter .agent_configuration import AgentConfiguration
43from test .pytestutils import before
4+ from test .help_utils import wait_for
55from mock import MagicMock
66
77from codeguru_profiler_agent .profiler_runner import ProfilerRunner
@@ -86,17 +86,7 @@ def test_when_orchestrator_says_no_to_profiler(self):
8686 # calling start in this test, it will start the scheduler and because initial delay is 0 it will execute now
8787 self .profiler_runner .start ()
8888 # still it is safer to wait until the new config has been applied
89- wait_until (lambda : AgentConfiguration .get ().should_profile == False )
89+ wait_for (lambda : AgentConfiguration .get ().should_profile is False )
9090
9191 assert self .profiler_runner .scheduler ._get_next_delay_seconds () == 150
9292 self .mock_collector .add .assert_not_called ()
93-
94-
95- def wait_until (predicate , max_wait_seconds = 1 , period_seconds = 0.1 ):
96- start = time .time ()
97- timeout = start + max_wait_seconds
98- while time .time () < timeout :
99- if predicate ():
100- return True
101- time .sleep (period_seconds )
102- raise AssertionError ("Predicate was never true after waiting for " + str (max_wait_seconds ) + " seconds" )
You can’t perform that action at this time.
0 commit comments