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

Function TestSystem_ParentChild

pkg/actor/actor_test.go:148–170  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

146}
147
148func TestSystem_ParentChild(t *testing.T) {
149 system := NewSystem("test")
150 defer system.Shutdown()
151
152 // 创建父 Actor
153 parent := &ParentActor{}
154 parentPID := system.Spawn(parent, "parent")
155
156 // 等待子 Actor 创建
157 time.Sleep(100 * time.Millisecond)
158
159 // 检查子 Actor 是否存在
160 childPID, exists := system.GetActor("child-1")
161 assert.True(t, exists)
162 assert.NotNil(t, childPID)
163
164 // 停止父 Actor 应该也停止子 Actor
165 system.Stop(parentPID)
166 time.Sleep(100 * time.Millisecond)
167
168 _, exists = system.GetActor("child-1")
169 assert.False(t, exists)
170}
171
172func TestSystem_SupervisorRestart(t *testing.T) {
173 config := DefaultSystemConfig()

Callers

nothing calls this directly

Calls 5

ShutdownMethod · 0.95
SpawnMethod · 0.95
GetActorMethod · 0.95
StopMethod · 0.95
NewSystemFunction · 0.85

Tested by

no test coverage detected