Skip to content

Commit

Permalink
test(er): fix broken exception ID asserts (#11869)
Browse files Browse the repository at this point in the history
The changes in #11772 broke ER tests that were relying on the old
exception ID tag. The rerun mechanism made the test pass on re-run so
the failure was not caught and the change was merged. Only the tests
were impacted, there was no impact on user-facing functionalities.

## 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
- [ ] 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
P403n1x87 authored Jan 8, 2025
1 parent 8dc9bdc commit a225334
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/debugging/exception/test_replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def c(foo=42):
for n, span in enumerate(self.spans):
assert span.get_tag(replay.DEBUG_INFO_TAG) == "true"

exc_id = span.get_tag("_dd.debug.error.exception_id")
exc_id = span.get_tag(replay.EXCEPTION_ID_TAG)

info = {k: v for k, v in enumerate(["c", "b", "a"][n:], start=1)}

Expand All @@ -147,8 +147,8 @@ def c(foo=42):
assert all(str(s.exc_id) == exc_id for s in snapshots.values())

# assert all spans use the same exc_id
exc_ids = set(span.get_tag("_dd.debug.error.exception_id") for span in self.spans)
assert len(exc_ids) == 1
exc_ids = set(span.get_tag(replay.EXCEPTION_ID_TAG) for span in self.spans)
assert None not in exc_ids and len(exc_ids) == 1

def test_debugger_exception_chaining(self):
def a(v, d=None):
Expand Down Expand Up @@ -190,7 +190,7 @@ def c(foo=42):
for n, span in enumerate(self.spans):
assert span.get_tag(replay.DEBUG_INFO_TAG) == "true"

exc_id = span.get_tag("_dd.debug.error.exception_id")
exc_id = span.get_tag(replay.EXCEPTION_ID_TAG)

info = {k: v for k, v in enumerate(stacks[n], start=1)}

Expand All @@ -215,8 +215,8 @@ def c(foo=42):
assert any(str(s.exc_id) == exc_id for s in snapshots.values())

# assert number of unique exc_ids based on python version
exc_ids = set(span.get_tag("_dd.debug.error.exception_id") for span in self.spans)
assert len(exc_ids) == number_of_exc_ids
exc_ids = set(span.get_tag(replay.EXCEPTION_ID_TAG) for span in self.spans)
assert None not in exc_ids and len(exc_ids) == number_of_exc_ids

# invoke again (should be in less than 1 sec)
with with_rate_limiter(rate_limiter):
Expand Down

0 comments on commit a225334

Please sign in to comment.