Skip to content

Commit 5956a11

Browse files
committed
reduce test flake
1 parent e0f72c0 commit 5956a11

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/profiler/test_continuous_profiler.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ def assert_single_transaction_with_profile_chunks(
171171

172172
for profile_chunk_item in items["profile_chunk"]:
173173
profile_chunk = profile_chunk_item.payload.json
174+
del profile_chunk["profile"] # make the diff easier to read
174175
assert profile_chunk == ApproxDict(
175176
{
176177
"client_sdk": {
@@ -370,7 +371,7 @@ def test_continuous_profiler_manual_start_and_stop_unsampled(
370371
pytest.param(get_client_options(False), id="experiment"),
371372
],
372373
)
373-
@mock.patch("sentry_sdk.profiler.continuous_profiler.PROFILE_BUFFER_SECONDS", 0.1)
374+
@mock.patch("sentry_sdk.profiler.continuous_profiler.DEFAULT_SAMPLING_FREQUENCY", 21)
374375
def test_continuous_profiler_auto_start_and_stop_sampled(
375376
sentry_init,
376377
capture_envelopes,
@@ -393,7 +394,7 @@ def test_continuous_profiler_auto_start_and_stop_sampled(
393394
for _ in range(3):
394395
envelopes.clear()
395396

396-
with sentry_sdk.start_transaction(name="profiling"):
397+
with sentry_sdk.start_transaction(name="profiling 1"):
397398
assert get_profiler_id() is not None, "profiler should be running"
398399
with sentry_sdk.start_span(op="op"):
399400
time.sleep(0.03)
@@ -403,14 +404,14 @@ def test_continuous_profiler_auto_start_and_stop_sampled(
403404
# immediately, it'll be part of the same chunk
404405
assert get_profiler_id() is not None, "profiler should be running"
405406

406-
with sentry_sdk.start_transaction(name="profiling"):
407+
with sentry_sdk.start_transaction(name="profiling 2"):
407408
assert get_profiler_id() is not None, "profiler should be running"
408409
with sentry_sdk.start_span(op="op"):
409410
time.sleep(0.03)
410411
assert get_profiler_id() is not None, "profiler should be running"
411412

412413
# wait at least 1 cycle for the profiler to stop
413-
time.sleep(0.05)
414+
time.sleep(0.2)
414415
assert get_profiler_id() is None, "profiler should not be running"
415416

416417
assert_single_transaction_with_profile_chunks(

0 commit comments

Comments
 (0)