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

Method TestBasicPingPong

examples/actor/actor_test.go:43–57  ·  view source on GitHub ↗

============================================================================= 测试用例 =============================================================================

()

Source from the content-addressed store, hash-verified

41// =============================================================================
42
43func (s *ActorSuite) TestBasicPingPong() {
44 // 创建 Echo Actor
45 echo := &EchoActor{name: "echo"}
46 pid := s.system.Spawn(echo, "echo")
47
48 // 发送 Ping 并等待 Pong
49 resp, err := pid.Request(&PingMsg{Count: 42}, time.Second)
50
51 s.Require().NoError(err, "请求不应失败")
52 s.Require().NotNil(resp, "响应不应为空")
53
54 pong, ok := resp.(*PongMsg)
55 s.Require().True(ok, "响应应为 PongMsg")
56 s.Equal(42, pong.Count, "计数应匹配")
57}
58
59func (s *ActorSuite) TestCounterConcurrency() {
60 // 使用更大的邮箱配置

Callers

nothing calls this directly

Calls 2

SpawnMethod · 0.45
RequestMethod · 0.45

Tested by

no test coverage detected