(t *testing.T)
| 29 | ) |
| 30 | |
| 31 | func 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 | |
| 58 | type MockController struct{} |
| 59 |
nothing calls this directly
no test coverage detected