(t *testing.T)
| 246 | } |
| 247 | |
| 248 | func 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 | |
| 289 | func TestTraceBuilder_EmptyEvents(t *testing.T) { |
| 290 | tb := NewTraceBuilder() |
nothing calls this directly
no test coverage detected