diff --git a/ddapm_test_agent/trace_snapshot.py b/ddapm_test_agent/trace_snapshot.py index a36b9d10..51fb9c4c 100644 --- a/ddapm_test_agent/trace_snapshot.py +++ b/ddapm_test_agent/trace_snapshot.py @@ -262,15 +262,11 @@ def _compare_traces(expected: Trace, received: Trace, ignored: Set[str]) -> None The given traces are assumed to be in BFS order. """ - if len(received) > len(expected): - names = ["'%s'" % s["name"] for s in received[len(expected) - len(received) :]] + if len(received) != len(expected): raise AssertionError( - f"Received more spans ({len(received)}) than expected ({len(expected)}). Received unmatched spans: {', '.join(names)}" - ) - elif len(expected) > len(received): - names = ["'%s'" % s["name"] for s in expected[len(received) - len(expected) :]] - raise AssertionError( - f"Received fewer spans ({len(received)}) than expected ({len(expected)}). Expected unmatched spans: {', '.join(names)}" + f"Received different number of spans ({len(received)}) than expected ({len(expected)})." + f"If spans<=20, will display received and expected.\nReceived: {received if (len(received) <= 20) else 'too long'}" + f"\nExpected: {expected if (len(expected) <= 20) else 'too long'}" ) for s_exp, s_rec in zip(expected, received):