MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / TestControllerCallClient_Invoke

Function TestControllerCallClient_Invoke

pkg/controller/client/call_test.go:31–56  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

29)
30
31func TestControllerCallClient_Invoke(t *testing.T) {
32 opt := options.NewOptions()
33 mc := &MockController{}
34 client := NewControllerCallClient(mc, nil, opt)
35 bodyStr := "{\"k1\":\"v1\"}"
36 ir := &api.InvokeRequest{
37 UserID: "df391b08c64c426a81645468c75163a5",
38 FunctionBRN: "brn:cloud:faas:bj:cd64f99c69d7c404b61de0a4f1865834:function:concurrentHello:1",
39 Body: &bodyStr,
40 RequestID: "xxx",
41 }
42 client.Invoke(ir)
43
44 read := bytes.NewBuffer(nil)
45 write := bytes.NewBuffer(nil)
46 bodyStream := bufio.NewReadWriter(bufio.NewReader(read), bufio.NewWriter(write))
47 ir2 := &api.InvokeRequest{
48 UserID: "df391b08c64c426a81645468c75163a5",
49 FunctionBRN: "brn:cloud:faas:bj:cd64f99c69d7c404b61de0a4f1865834:function:concurrentHello:1",
50 BodyStream: bodyStream,
51 RequestID: "xxx",
52 WithBodyStream: true,
53 }
54 client.Invoke(ir2)
55 return
56}
57
58type MockController struct{}
59

Callers

nothing calls this directly

Calls 3

InvokeMethod · 0.95
NewOptionsFunction · 0.92
NewControllerCallClientFunction · 0.85

Tested by

no test coverage detected