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

Function TestTaskTool_ConcurrentSubagentLaunch

pkg/tools/builtin/task_test.go:251–290  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

249}
250
251func 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
292func TestTaskTool_PerformanceInfo(t *testing.T) {
293 tool, err := NewTaskTool(nil)

Callers

nothing calls this directly

Calls 3

NewTaskToolFunction · 0.85
RunConcurrentTestFunction · 0.85
ExecuteToolWithInputFunction · 0.85

Tested by

no test coverage detected