(t *testing.T)
| 249 | } |
| 250 | |
| 251 | func TestTaskTool_ConcurrentSubagentLaunch(t *testing.T) { |
| 252 | if testing.Short() { |
| 253 | t.Skip("Skipping concurrent subagent test in short mode") |
| 254 | } |
| 255 | |
| 256 | tool, err := NewTaskTool(nil) |
| 257 | if err != nil { |
| 258 | t.Fatalf("Failed to create Task tool: %v", err) |
| 259 | } |
| 260 | |
| 261 | concurrency := 3 |
| 262 | result := RunConcurrentTest(concurrency, func() error { |
| 263 | input := map[string]any{ |
| 264 | "subagent_type": "general-purpose", |
| 265 | "prompt": "Concurrent test task", |
| 266 | "timeout_minutes": 1, |
| 267 | } |
| 268 | |
| 269 | result := ExecuteToolWithInput(t, tool, input) |
| 270 | if !result["ok"].(bool) { |
| 271 | return errors.New("Task launch failed") |
| 272 | } |
| 273 | |
| 274 | // 验证task_id不为空 |
| 275 | taskID := result["task_id"].(string) |
| 276 | if taskID == "" { |
| 277 | return errors.New("Empty task_id returned") |
| 278 | } |
| 279 | |
| 280 | return nil |
| 281 | }) |
| 282 | |
| 283 | if result.ErrorCount > 0 { |
| 284 | t.Errorf("Concurrent subagent launch failed: %d errors out of %d attempts", |
| 285 | result.ErrorCount, concurrency) |
| 286 | } |
| 287 | |
| 288 | t.Logf("Concurrent subagent launch completed: %d success, %d errors in %v", |
| 289 | result.SuccessCount, result.ErrorCount, result.Duration) |
| 290 | } |
| 291 | |
| 292 | func TestTaskTool_PerformanceInfo(t *testing.T) { |
| 293 | tool, err := NewTaskTool(nil) |
nothing calls this directly
no test coverage detected