Skip to content

Commit ae9b6a7

Browse files
test(profiling): fix flakiness in test_asyncio_coroutines (#15473)
## Description This unflakes the `test_asyncio_coroutines` test for Profiling. It still isn't clear why it never flaked locally, but the root cause of flakiness was that we were searching for the expected stacks in `samples`, which was `profile.sample` filtered by "has a `task name` label" – sometimes those stacks wouldn't have a stack name. Why that is isn't clear either, but given that we are making lots of improvements to asyncio right now, I think this is going to get better soon. [No flakes in CI Viz](https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest%20%40git.branch%3Akowalski%2Ftest-profiling-fix-flakiness-in-test_asyncio_coroutines%20%40test.service%3Add-trace-py%20%40test.status%3Afail%20%40ci.stage.name%3A%2Aprof%2A%20%40ci.provider.name%3Agitlab&agg_m=count&agg_m_source=base&agg_q=%40test.name&agg_q_source=base&agg_t=count&currentTab=overview&eventStack=&fromUser=false&index=citest&top_n=30&top_o=top&viz=timeseries&x_missing=true&start=1764574483529&end=1764660883529&paused=false)
1 parent 5cbc5a1 commit ae9b6a7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

tests/profiling/collector/test_asyncio_coroutines.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import pytest
22

33

4-
@pytest.mark.xfail(reason="This test is flaky.")
54
@pytest.mark.subprocess(
65
env=dict(
76
DD_PROFILING_OUTPUT_PPROF="/tmp/test_asyncio_coroutines",
@@ -133,7 +132,7 @@ async def outer_function() -> None:
133132
# Test that we see the background_math_function task
134133
pprof_utils.assert_profile_has_sample(
135134
profile,
136-
samples,
135+
list(profile.sample),
137136
expected_sample=pprof_utils.StackEvent(
138137
thread_name="MainThread",
139138
locations=[

0 commit comments

Comments
 (0)