Skip to content

Commit

Permalink
chore: skip failing urlib3 ASM test (#11861)
Browse files Browse the repository at this point in the history
- There seems to be a bug in the ASM Standalone logic where the
`_dd.p.appsec` tag is not being set on `urllib3` spans. Since this tag
is not set x-datadog distributed tracing headers are not generated.

## 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)
  • Loading branch information
mabdinur authored Jan 8, 2025
1 parent 33b2499 commit 86a367a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/contrib/urllib3/test_urllib3.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from ddtrace.ext import http
from ddtrace.internal.schema import DEFAULT_SPAN_SERVICE_NAME
from ddtrace.pin import Pin
from ddtrace.settings.asm import config as asm_config
from tests.contrib.config import HTTPBIN_CONFIG
from tests.opentracer.utils import init_tracer
from tests.utils import TracerTestCase
Expand Down Expand Up @@ -527,12 +528,16 @@ def test_distributed_tracing_disabled(self):
timeout=mock.ANY,
)

@pytest.mark.skip(reason="urlib3 does not set the ASM Manual keep tag so x-datadog headers are not propagated")
def test_distributed_tracing_apm_opt_out_true(self):
"""Tests distributed tracing headers are passed by default"""
# Check that distributed tracing headers are passed down; raise an error rather than make the
# request since we don't care about the response at all
config.urllib3["distributed_tracing"] = True
self.tracer.enabled = False
# Ensure the ASM SpanProcessor is set
self.tracer.configure(appsec_standalone_enabled=True, appsec_enabled=True)
assert asm_config._apm_opt_out
with mock.patch(
"urllib3.connectionpool.HTTPConnectionPool._make_request", side_effect=ValueError
) as m_make_request:
Expand Down Expand Up @@ -580,6 +585,9 @@ def test_distributed_tracing_apm_opt_out_false(self):
"""Test with distributed tracing disabled does not propagate the headers"""
config.urllib3["distributed_tracing"] = True
self.tracer.enabled = False
# Ensure the ASM SpanProcessor is set.
self.tracer.configure(appsec_standalone_enabled=False, appsec_enabled=True)
assert not asm_config._apm_opt_out
with mock.patch(
"urllib3.connectionpool.HTTPConnectionPool._make_request", side_effect=ValueError
) as m_make_request:
Expand Down

0 comments on commit 86a367a

Please sign in to comment.