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

Function TestSystem_RequestResponse

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

Source from the content-addressed store, hash-verified

128}
129
130func TestSystem_RequestResponse(t *testing.T) {
131 system := NewSystem("test")
132 defer system.Shutdown()
133
134 // 创建回声 Actor
135 pid := system.Spawn(&EchoActor{}, "echo")
136
137 // 发送请求并等待响应
138 resp, err := system.Request(pid, &PingMsg{Count: 42}, time.Second)
139
140 require.NoError(t, err)
141 require.NotNil(t, resp)
142
143 pong, ok := resp.(*PongMsg)
144 require.True(t, ok)
145 assert.Equal(t, 42, pong.Count)
146}
147
148func TestSystem_ParentChild(t *testing.T) {
149 system := NewSystem("test")

Callers

nothing calls this directly

Calls 4

ShutdownMethod · 0.95
SpawnMethod · 0.95
RequestMethod · 0.95
NewSystemFunction · 0.85

Tested by

no test coverage detected