fn: agent/lb/runner error handling adjustments (#1214)

1) Early call validation and return due to cpu/mem impossible
to meet (eg. request cpu/mem larger than max-mem or max-cpu
on server) now emits HTTP Bad Request (400) instead of 503.
This case is most likely due to client/service configuration
and/or validation issue.
2) 'failed' metric is now removed. 'failed' versus 'errors'
were too confusing. 'errors' is now a catch all error case.
3) new 'canceled' counter for client side cancels.
4) 'server_busy' now covers more cases than it previously did.
This commit is contained in:
Tolga Ceylan
2018-09-14 16:50:14 -07:00
committed by GitHub
parent 75bd0d3414
commit aa13a40168
11 changed files with 115 additions and 172 deletions

View File

@@ -225,39 +225,6 @@ func TestBasicConcurrentExecution(t *testing.T) {
}
func TestSaturatedSystem(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 4*time.Second)
defer cancel()
rt := &models.Route{
Path: routeName,
Timeout: 1,
Image: "fnproject/fn-test-utils",
Format: "json",
Memory: 300,
Type: "sync",
}
rt = ensureRoute(t, rt)
lb, err := LB()
if err != nil {
t.Fatalf("Got unexpected error: %v", err)
}
u := url.URL{
Scheme: "http",
Host: lb,
}
u.Path = path.Join(u.Path, "r", appName, rt.Path)
body := `{"echoContent": "HelloWorld", "sleepTime": 0, "isDebug": true}`
content := bytes.NewBuffer([]byte(body))
output := &bytes.Buffer{}
resp, err := callFN(ctx, u.String(), content, output, "POST")
if resp != nil || err == nil || ctx.Err() == nil {
t.Fatalf("Expected response: %v err:%v", resp, err)
}
}
func callFN(ctx context.Context, u string, content io.Reader, output io.Writer, method string) (*http.Response, error) {
if method == "" {
if content == nil {