Skip to content

Commit f163540

Browse files
ci: fix flaky tracer tests (#13616)
Currently the tracer `iast_enabled` setting is not properly reset in tracer tests, causing some subsequent tests to fail with errors like: ``` FAILED tests/tracer/test_writer.py::test_writer_api_version_selection[AgentWriter-darwin-None-None-False-v0.5_1] - AssertionError: assert 'v0.4' == 'v0.5' - v0.5 ? ^ + v0.4 ? ^ ``` This PR fixes it. ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) Co-authored-by: Brett Langdon <brett.langdon@datadoghq.com>
1 parent 0a2688a commit f163540

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/tracer/test_propagation.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ def test_asm_standalone_minimum_trace_per_minute_has_no_downstream_propagation(
376376
finally:
377377
with override_env({"DD_APPSEC_SCA_ENABLED": "0"}):
378378
ddtrace.config._reset()
379-
tracer.configure(appsec_enabled=False, apm_tracing_disabled=False)
379+
tracer.configure(appsec_enabled=False, apm_tracing_disabled=False, iast_enabled=False)
380380

381381

382382
@pytest.mark.parametrize("sca_enabled", ["true", "false"])
@@ -421,7 +421,7 @@ def test_asm_standalone_missing_propagation_tags_no_appsec_event_trace_dropped(
421421
finally:
422422
with override_env({"DD_APPSEC_SCA_ENABLED": "0"}):
423423
ddtrace.config._reset()
424-
tracer.configure(appsec_enabled=False, apm_tracing_disabled=False)
424+
tracer.configure(appsec_enabled=False, apm_tracing_disabled=False, iast_enabled=False)
425425

426426

427427
def test_asm_standalone_missing_propagation_tags_appsec_event_present_trace_kept(tracer): # noqa: F811
@@ -455,7 +455,7 @@ def test_asm_standalone_missing_propagation_tags_appsec_event_present_trace_kept
455455
# Ensure span is user keep
456456
assert span._metrics["_sampling_priority_v1"] == USER_KEEP
457457
finally:
458-
tracer.configure(appsec_enabled=False, apm_tracing_disabled=False)
458+
tracer.configure(appsec_enabled=False, apm_tracing_disabled=False, iast_enabled=False)
459459

460460

461461
@pytest.mark.parametrize("sca_enabled", ["true", "false"])
@@ -514,7 +514,7 @@ def test_asm_standalone_missing_appsec_tag_no_appsec_event_propagation_resets(
514514
finally:
515515
with override_env({"DD_APPSEC_SCA_ENABLED": "false"}):
516516
ddtrace.config._reset()
517-
tracer.configure(appsec_enabled=False, apm_tracing_disabled=False)
517+
tracer.configure(appsec_enabled=False, apm_tracing_disabled=False, iast_enabled=False)
518518

519519

520520
def test_asm_standalone_missing_appsec_tag_appsec_event_present_trace_kept(
@@ -562,7 +562,7 @@ def test_asm_standalone_missing_appsec_tag_appsec_event_present_trace_kept(
562562
assert span._metrics["_sampling_priority_v1"] == USER_KEEP
563563

564564
finally:
565-
tracer.configure(appsec_enabled=False, apm_tracing_disabled=False)
565+
tracer.configure(appsec_enabled=False, apm_tracing_disabled=False, iast_enabled=False)
566566

567567

568568
@pytest.mark.parametrize("upstream_priority", ["1", "2"])
@@ -631,7 +631,7 @@ def test_asm_standalone_present_appsec_tag_no_appsec_event_propagation_set_to_us
631631
finally:
632632
with override_env({"DD_APPSEC_SCA_ENABLED": sca_enabled}):
633633
ddtrace.config._reset()
634-
tracer.configure(appsec_enabled=False, apm_tracing_disabled=False)
634+
tracer.configure(appsec_enabled=False, apm_tracing_disabled=False, iast_enabled=False)
635635

636636

637637
@pytest.mark.parametrize("upstream_priority", ["1", "2"])
@@ -700,7 +700,7 @@ def test_asm_standalone_present_appsec_tag_appsec_event_present_propagation_forc
700700
finally:
701701
with override_env({"DD_APPSEC_SCA_ENABLED": sca_enabled}):
702702
ddtrace.config._reset()
703-
tracer.configure(appsec_enabled=False, apm_tracing_disabled=False)
703+
tracer.configure(appsec_enabled=False, apm_tracing_disabled=False, iast_enabled=False)
704704

705705

706706
def test_extract_with_baggage_http_propagation(tracer): # noqa: F811

0 commit comments

Comments
 (0)