Compare commits

...

1 Commits

Author SHA1 Message Date
peze 5ff9708f43 add retry options config 2025-03-31 16:36:54 +08:00
2 changed files with 13 additions and 0 deletions
+3
View File
@@ -150,6 +150,9 @@ func NewRuntimeObject(runtime map[string]interface{}) *RuntimeObject {
if runtime["httpClient"] != nil {
runtimeObject.HttpClient = runtime["httpClient"].(HttpClient)
}
if runtime["retryOptions"] != nil {
runtimeObject.RetryOptions = runtime["retryOptions"].(*RetryOptions)
}
return runtimeObject
}
+10
View File
@@ -30,6 +30,12 @@ var runtimeObj = map[string]interface{}{
"listener": &Progresstest{},
"tracker": &utils.ReaderTracker{CompletedBytes: int64(10)},
"logger": utils.NewLogger("info", "", &bytes.Buffer{}, "{time}"),
"retryOptions": &RetryOptions{
Retryable: true,
RetryCondition: []*RetryCondition{
{MaxAttempts: 3, Exception: []string{"AErr"}, ErrorCode: []string{"A1Err"}},
},
},
}
var key = `-----BEGIN RSA PRIVATE KEY-----
@@ -193,6 +199,10 @@ func TestRuntimeObject(t *testing.T) {
runtimeobject = NewRuntimeObject(runtimeObj)
utils.AssertEqual(t, false, BoolValue(runtimeobject.IgnoreSSL))
utils.AssertEqual(t, true, runtimeobject.RetryOptions.Retryable)
utils.AssertEqual(t, 1, len(runtimeobject.RetryOptions.RetryCondition))
}
func TestSDKError(t *testing.T) {