Skip to content

Commit 399c6ad

Browse files
authored
ci: delay expiration for flaky tests (#8005)
1 parent dbe4869 commit 399c6ad

File tree

12 files changed

+75
-19
lines changed

12 files changed

+75
-19
lines changed

tests/appsec/integrations/test_flask_remoteconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def test_load_testing_appsec_ip_blocking_gunicorn_block_and_kill_child_worker():
276276
_request_200(gunicorn_client)
277277

278278

279-
@flaky(until=1704067200, reason="_request_403 is flaky, figure out the error")
279+
@flaky(until=1706677200, reason="_request_403 is flaky, figure out the error")
280280
def test_load_testing_appsec_1click_and_ip_blocking_gunicorn_block_and_kill_child_worker():
281281
token = "test_load_testing_appsec_1click_and_ip_blocking_gunicorn_block_and_kill_child_worker_{}".format(
282282
str(uuid.uuid4())

tests/appsec/integrations/test_flask_telemetry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from tests.utils import flaky
33

44

5-
@flaky(until=1704067200)
5+
@flaky(until=1706677200)
66
def test_iast_span_metrics():
77
with flask_server(iast_enabled="true", token=None) as context:
88
_, flask_client, pid = context
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import asyncio
2+
3+
import pytest
4+
5+
from ddtrace.contrib.asyncio.compat import asyncio_current_task
6+
from ddtrace.internal.compat import CONTEXTVARS_IS_AVAILABLE
7+
from ddtrace.provider import DefaultContextProvider
8+
from tests.utils import flaky
9+
10+
11+
pytestmark = pytest.mark.skipif(
12+
CONTEXTVARS_IS_AVAILABLE, reason="No configuration is necessary when contextvars available."
13+
)
14+
15+
16+
@pytest.mark.asyncio
17+
async def test_get_call_context(tracer):
18+
tracer.configure(context_provider=DefaultContextProvider())
19+
ctx = tracer.current_trace_context()
20+
assert ctx is None
21+
# test that it behaves the wrong way
22+
task = asyncio_current_task()
23+
assert task
24+
task_ctx = getattr(task, "__datadog_context", None)
25+
assert task_ctx is None
26+
27+
28+
def test_trace_coroutine(tracer):
29+
# it should use the task context when invoked in a coroutine
30+
with tracer.trace("coroutine") as span:
31+
span.resource = "base"
32+
33+
traces = tracer.pop_traces()
34+
assert 1 == len(traces)
35+
assert 1 == len(traces[0])
36+
assert "coroutine" == traces[0][0].name
37+
assert "base" == traces[0][0].resource
38+
39+
40+
@flaky(until=1706677200)
41+
@pytest.mark.asyncio
42+
async def test_trace_multiple_calls(tracer):
43+
tracer.configure(context_provider=DefaultContextProvider())
44+
45+
async def coro():
46+
# another traced coroutine
47+
with tracer.trace("coroutine"):
48+
await asyncio.sleep(0.01)
49+
50+
# partial flushing is enabled, ensure the number of spans generated is less than 500
51+
futures = [asyncio.ensure_future(coro()) for x in range(400)]
52+
for future in futures:
53+
await future
54+
55+
# the trace is wrong but the Context is finished
56+
traces = tracer.pop_traces()
57+
assert 1 == len(traces)
58+
assert 400 == len(traces[0])

tests/contrib/django/test_django_snapshots.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def test_middleware_trace_callable_view(client):
8585
assert client.get("/feed-view/").status_code == 200
8686

8787

88-
@flaky(until=1704067200)
88+
@flaky(until=1706677200)
8989
@pytest.mark.skipif(
9090
sys.version_info >= (3, 10, 0),
9191
reason=("func_name changed with Python 3.10 which changes the resource name." "TODO: new snapshot required."),

tests/contrib/flask/test_flask_snapshot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def test_flask_stream(flask_client):
117117
assert resp.status_code == 200
118118

119119

120-
@flaky(until=1704067200)
120+
@flaky(until=1706677200)
121121
@pytest.mark.snapshot(
122122
ignores=["meta.flask.version", "meta.http.useragent"],
123123
variants={"220": flask_version >= (2, 2, 0), "": flask_version < (2, 2, 0)},

tests/contrib/gunicorn/test_gunicorn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def gunicorn_server(gunicorn_server_settings, tmp_path):
176176
)
177177

178178

179-
@flaky(until=1704067200)
179+
@flaky(until=1706677200)
180180
@pytest.mark.skipif(sys.version_info >= (3, 11), reason="Gunicorn is only supported up to 3.10")
181181
def test_no_known_errors_occur(tmp_path):
182182
for gunicorn_server_settings in [
@@ -195,7 +195,7 @@ def test_no_known_errors_occur(tmp_path):
195195
assert payload["profiler"]["is_active"] is True
196196

197197

198-
@flaky(until=1704067200)
198+
@flaky(until=1706677200)
199199
@pytest.mark.skipif(sys.version_info >= (3, 11), reason="Gunicorn is only supported up to 3.10")
200200
def test_span_schematization(tmp_path):
201201
for schema_version in [None, "v0", "v1"]:

tests/contrib/kafka/test_kafka.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def test_produce_multiple_servers(dummy_tracer, kafka_topic):
237237
assert produce_span.get_tag("messaging.kafka.bootstrap.servers") == ",".join([BOOTSTRAP_SERVERS] * 3)
238238

239239

240-
@flaky(until=1704067200)
240+
@flaky(until=1706677200)
241241
@pytest.mark.parametrize("tombstone", [False, True])
242242
@pytest.mark.snapshot(ignores=["metrics.kafka.message_offset"])
243243
def test_message(producer, consumer, tombstone, kafka_topic):

tests/contrib/pyramid/test_pyramid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def pyramid_client(snapshot, pyramid_app):
253253
proc.terminate()
254254

255255

256-
@flaky(until=1704067200)
256+
@flaky(until=1706677200)
257257
@pytest.mark.parametrize(
258258
"pyramid_app",
259259
[

tests/debugging/probe/test_remoteconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ def test_parse_metric_probe_with_probeid_tags():
546546
assert probe.tags["debugger.probeid"] == probeId
547547

548548

549-
@flaky(until=1704067200)
549+
@flaky(until=1706677200)
550550
def test_modified_probe_events(remote_config_worker, mock_config):
551551
events = []
552552

tests/debugging/test_debugger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ def __init__(self, age, name):
886886
assert snapshot, d.test_queue
887887

888888

889-
@flaky(until=1704067200)
889+
@flaky(until=1706677200)
890890
def test_debugger_log_live_probe_generate_messages():
891891
from tests.submod.stuff import Stuff
892892

0 commit comments

Comments
 (0)