Skip to content

Commit 411420c

Browse files
committed
Fix test to account for duplicated string_at
1 parent b96895f commit 411420c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

runtime_stacks_quick_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python3
21
"""
32
Test script to verify Echion-based stack walking in crashtracker.
43

tests/internal/crashtracker/test_crashtracker.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ def test_crashtracker_tags_required():
458458

459459
@pytest.mark.skipif(not sys.platform.startswith("linux"), reason="Linux only")
460460
def test_crashtracker_runtime_stacktrace_required(run_python_code_in_subprocess):
461+
import json
461462
with utils.with_test_agent() as client:
462463
env = os.environ.copy()
463464
env["DD_CRASHTRACKING_EMIT_RUNTIME_STACKS"] = "true"
@@ -473,12 +474,13 @@ def test_crashtracker_runtime_stacktrace_required(run_python_code_in_subprocess)
473474

474475
# Check for crash report
475476
report = utils.get_crash_report(client)
476-
assert b"stacktrace_string" in report["body"]
477477

478-
version = sys.version_info[:2]
479-
# Runtime stacktrace is available only on Python 3.11 and 3.12
480-
expected = b"in string_at" if (3, 11) <= version <= (3, 12) else b"<python_runtime_stacktrace_unavailable>"
481-
assert expected in report["body"], report["body"]
478+
# We should get the experimental field because `string_at` is in both the
479+
# native frames stacktrace and experimental runtime_stacks field
480+
body = json.loads(report["body"])
481+
message = json.loads(body["payload"][0]["message"])
482+
assert "string_at" in json.dumps(message["experimental"])
483+
482484

483485

484486
@pytest.mark.skipif(not sys.platform.startswith("linux"), reason="Linux only")

0 commit comments

Comments
 (0)