mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: handleCallEnd and submit improvements (#919)
* fn: move call error/end handling to handleCallEnd This simplifies submit() function but moves the burden of retriable-versus-committed request handling and slot.Close() responsibility to handleCallEnd().
This commit is contained in:
@@ -314,11 +314,19 @@ func TestCanWriteLogs(t *testing.T) {
|
||||
}
|
||||
|
||||
// TODO this test is redundant we have 3 tests for this?
|
||||
_, err := s.Client.Operations.GetAppsAppCallsCallLog(cfg)
|
||||
if err != nil {
|
||||
t.Error(err.Error())
|
||||
}
|
||||
retryErr := APICallWithRetry(t, 10, time.Second*2, func() (err error) {
|
||||
_, err = s.Client.Operations.GetAppsAppCallsCallLog(cfg)
|
||||
return err
|
||||
})
|
||||
|
||||
if retryErr != nil {
|
||||
t.Error(retryErr.Error())
|
||||
} else {
|
||||
_, err := s.Client.Operations.GetAppsAppCallsCallLog(cfg)
|
||||
if err != nil {
|
||||
t.Error(err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestOversizedLog(t *testing.T) {
|
||||
@@ -353,10 +361,18 @@ func TestOversizedLog(t *testing.T) {
|
||||
Context: s.Context,
|
||||
}
|
||||
|
||||
logObj, err := s.Client.Operations.GetAppsAppCallsCallLog(cfg)
|
||||
if err != nil {
|
||||
t.Error(err.Error())
|
||||
retryErr := APICallWithRetry(t, 10, time.Second*2, func() (err error) {
|
||||
_, err = s.Client.Operations.GetAppsAppCallsCallLog(cfg)
|
||||
return err
|
||||
})
|
||||
|
||||
if retryErr != nil {
|
||||
t.Error(retryErr.Error())
|
||||
} else {
|
||||
logObj, err := s.Client.Operations.GetAppsAppCallsCallLog(cfg)
|
||||
if err != nil {
|
||||
t.Error(err.Error())
|
||||
}
|
||||
log := logObj.Payload.Log.Log
|
||||
if len(log) >= size {
|
||||
t.Errorf("Log entry suppose to be truncated up to expected size %v, got %v",
|
||||
|
||||
Reference in New Issue
Block a user