Skip to content

Commit 05769a2

Browse files
Fix unit test test_profiler_runner that was failing sometimes.
1 parent 3afb9dc commit 05769a2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/unit/test_profiler_runner.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from test.pytestutils import before
44
from test.help_utils import wait_for
55
from mock import MagicMock
6+
from time import sleep
67

78
from codeguru_profiler_agent.profiler_runner import ProfilerRunner
89
from codeguru_profiler_agent.profiler_disabler import ProfilerDisabler
@@ -87,6 +88,9 @@ def test_when_orchestrator_says_no_to_profiler(self):
8788
self.profiler_runner.start()
8889
# still it is safer to wait until the new config has been applied
8990
wait_for(lambda: AgentConfiguration.get().reporting_interval.total_seconds() == 151)
91+
# sometimes it takes a few milliseconds for the scheduler to be updated with the AgentConfiguration,
92+
# so let's sleep for 100 ms
93+
sleep(0.1)
9094

9195
assert self.profiler_runner.scheduler._get_next_delay_seconds() == 151
9296
self.mock_collector.add.assert_not_called()

0 commit comments

Comments
 (0)