MCPcopy Create free account
hub / github.com/astercloud/aster / TestTraceBuilder_ErrorHandling

Function TestTraceBuilder_ErrorHandling

pkg/dashboard/trace_builder_test.go:248–287  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

246}
247
248func TestTraceBuilder_ErrorHandling(t *testing.T) {
249 tb := NewTraceBuilder()
250
251 now := time.Now()
252 events := []types.AgentEventEnvelope{
253 {
254 Cursor: 1,
255 Bookmark: types.Bookmark{
256 Cursor: 1,
257 Timestamp: now.UnixMilli(),
258 },
259 Event: types.MonitorStepCompleteEvent{
260 Step: 1,
261 DurationMs: 100,
262 },
263 },
264 {
265 Cursor: 2,
266 Bookmark: types.Bookmark{
267 Cursor: 2,
268 Timestamp: now.Add(50 * time.Millisecond).UnixMilli(),
269 },
270 Event: types.MonitorErrorEvent{
271 Severity: "error",
272 Phase: "model",
273 Message: "API rate limit exceeded",
274 },
275 },
276 }
277
278 root := tb.buildSpanTree(events)
279
280 if root == nil {
281 t.Fatal("buildSpanTree() returned nil")
282 }
283
284 if root.Status != TraceStatusError {
285 t.Errorf("buildSpanTree() root status = %v, want error", root.Status)
286 }
287}
288
289func TestTraceBuilder_EmptyEvents(t *testing.T) {
290 tb := NewTraceBuilder()

Callers

nothing calls this directly

Calls 3

buildSpanTreeMethod · 0.95
NewTraceBuilderFunction · 0.85
AddMethod · 0.65

Tested by

no test coverage detected