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:
Tolga Ceylan
2018-04-10 10:48:12 -07:00
committed by GitHub
parent f705fc8d8f
commit ee262901a2
4 changed files with 116 additions and 69 deletions

View File

@@ -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",