MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / TestCall_NodeReturnsError

Function TestCall_NodeReturnsError

internal/nodehub/hub_test.go:224–239  ·  view source on GitHub ↗

---- 测试:Call 错误响应 ----

(t *testing.T)

Source from the content-addressed store, hash-verified

222// ---- 测试:Call 错误响应 ----
223
224func TestCall_NodeReturnsError(t *testing.T) {
225 hub := New(Options{PeerExtractor: mdPeerExtractor})
226 env := newTestEnv(t, hub)
227 cc := env.dial(t)
228 mock := startNodeMock(t, cc, "n")
229 waitOnline(t, hub, "n")
230
231 mock.handle("boom", func(string, []byte) (bool, []byte, string) {
232 return false, nil, "kaboom"
233 })
234
235 _, err := hub.Call(context.Background(), "n", "boom", nil)
236 if err == nil || !strings.Contains(err.Error(), "kaboom") {
237 t.Fatalf("expected kaboom error, got %v", err)
238 }
239}
240
241// ---- 测试:ctx 超时 + cancel_id 下发 ----
242

Callers

nothing calls this directly

Calls 8

newTestEnvFunction · 0.85
startNodeMockFunction · 0.85
waitOnlineFunction · 0.85
dialMethod · 0.80
NewFunction · 0.70
CallMethod · 0.65
handleMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected