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

Function TestPool_Status

pkg/core/pool_test.go:262–295  ·  view source on GitHub ↗

TestPool_Status 测试获取 Agent 状态

(t *testing.T)

Source from the content-addressed store, hash-verified

260
261// TestPool_Status 测试获取 Agent 状态
262func TestPool_Status(t *testing.T) {
263 deps := createTestDeps(t)
264 pool := NewPool(&PoolOptions{
265 Dependencies: deps,
266 MaxAgents: 5,
267 })
268 defer func() {
269 if err := pool.Shutdown(); err != nil {
270 t.Errorf("Shutdown failed: %v", err)
271 }
272 }()
273
274 ctx := context.Background()
275 config := createTestConfig("test-agent")
276
277 _, err := pool.Create(ctx, config)
278 if err != nil {
279 t.Fatalf("Failed to create agent: %v", err)
280 }
281
282 // 获取状态
283 status, err := pool.Status("test-agent")
284 if err != nil {
285 t.Fatalf("Failed to get status: %v", err)
286 }
287
288 if status == nil {
289 t.Fatal("Status is nil")
290 }
291
292 if status.AgentID != "test-agent" {
293 t.Errorf("Expected AgentID 'test-agent', got '%s'", status.AgentID)
294 }
295}
296
297// TestPool_ConcurrentAccess 测试并发访问
298func TestPool_ConcurrentAccess(t *testing.T) {

Callers

nothing calls this directly

Calls 6

ShutdownMethod · 0.95
CreateMethod · 0.95
StatusMethod · 0.95
createTestDepsFunction · 0.85
NewPoolFunction · 0.85
createTestConfigFunction · 0.85

Tested by

no test coverage detected