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

Function TestLifecycle

pkg/asteros/asteros_test.go:282–308  ·  view source on GitHub ↗

TestLifecycle 测试生命周期

(t *testing.T)

Source from the content-addressed store, hash-verified

280
281// TestLifecycle 测试生命周期
282func TestLifecycle(t *testing.T) {
283 deps := createTestDependencies(t)
284 pool := core.NewPool(&core.PoolOptions{
285 Dependencies: deps,
286 MaxAgents: 5,
287 })
288
289 os, err := New(&Options{
290 Name: "TestOS",
291 Port: 8080,
292 Pool: pool,
293 })
294 if err != nil {
295 t.Fatalf("Failed to create AsterOS: %v", err)
296 }
297
298 // 初始状态应该不是运行中
299 if os.IsRunning() {
300 t.Error("AsterOS should not be running initially")
301 }
302
303 // 关闭未运行的 AsterOS 应该失败
304 err = os.Shutdown()
305 if err == nil {
306 t.Error("Expected error for shutting down non-running AsterOS")
307 }
308}
309
310// TestGetters 测试 Getter 方法
311func TestGetters(t *testing.T) {

Callers

nothing calls this directly

Calls 6

NewPoolFunction · 0.92
createTestDependenciesFunction · 0.85
IsRunningMethod · 0.80
NewFunction · 0.70
ErrorMethod · 0.65
ShutdownMethod · 0.45

Tested by

no test coverage detected