mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
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:
@@ -299,38 +299,6 @@ func TestBasicTriggerConcurrentExecution(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
func TestTriggerSaturatedSystem(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 4*time.Second)
|
||||
defer cancel()
|
||||
|
||||
app := ensureApp(t, rp.ValidApp())
|
||||
validFn := rp.ValidFn(app.ID)
|
||||
validFn.ResourceConfig.Timeout = 1
|
||||
validFn.ResourceConfig.Memory = 300
|
||||
|
||||
fn := ensureFn(t, validFn)
|
||||
trigger := ensureTrigger(t, rp.ValidTrigger(app.ID, fn.ID))
|
||||
|
||||
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, "t", app.Name, trigger.Source)
|
||||
|
||||
body := `{"echoContent": "HelloWorld", "sleepTime": 0, "isDebug": true}`
|
||||
content := bytes.NewBuffer([]byte(body))
|
||||
output := &bytes.Buffer{}
|
||||
|
||||
resp, err := callTrigger(ctx, u.String(), content, output, "POST")
|
||||
if resp != nil || err == nil || ctx.Err() == nil {
|
||||
t.Fatalf("Expected response: %v err:%v", resp, err)
|
||||
}
|
||||
}
|
||||
|
||||
func callTrigger(ctx context.Context, u string, content io.Reader, output io.Writer, method string) (*http.Response, error) {
|
||||
if method == "" {
|
||||
if content == nil {
|
||||
|
||||
Reference in New Issue
Block a user