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

Function initRuntime

pkg/controller/rtctrl/client_test.go:155–171  ·  view source on GitHub ↗
(s *DispatchServerV2, runtimeID string, commitID string, requestID string)

Source from the content-addressed store, hash-verified

153}
154
155func initRuntime(s *DispatchServerV2, runtimeID string, commitID string, requestID string) {
156 body := `{"key1":1,"key2":2}`
157 req := httptest.NewRequest("POST", "/status", strings.NewReader(body))
158 req.Header.Set("x-cfc-runtimeid", runtimeID)
159 req.Header.Set("x-cfc-commitid", commitID)
160 req.Header.Set("x-cfc-hostip", "127.0.0.1")
161 q := req.URL.Query()
162 q.Add("initstart", "10")
163 q.Add("initdone", "20")
164 q.Add("concurrentmode", "false")
165 req.URL.RawQuery = q.Encode()
166 bodyString := fmt.Sprintf("{\"requestid\":\"%s\", \"success\": \"true\"}\n", requestID)
167 bodyBytes := []byte(bodyString)
168 resp := kunhttptest.NewResponseHijacker(bodyBytes)
169
170 s.invokeHandler(resp, req)
171}

Callers 2

TestInvocationFunction · 0.85
TestInvocationWithStreamFunction · 0.85

Calls 4

invokeHandlerMethod · 0.80
SetMethod · 0.65
EncodeMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected