support time duration literal

This commit is contained in:
Alex Wong
2019-03-12 14:29:50 +08:00
parent 17e6f35785
commit b5932e8905
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -39,14 +39,14 @@ func init() {
if err != nil {
return nil, errors.New("metadata auth provided is invalid, base64 encoded username:password required")
}
interval, err := strconv.Atoi(pollInterval)
interval, err := time.ParseDuration(pollInterval)
if err != nil {
interval = 1
}
return &NGrinderTask{
TaskBase{canary, logger},
baseUrl, cloneId, username, string(passwdDecoded), -1, time.Duration(interval),
baseUrl, cloneId, username, string(passwdDecoded), -1, interval,
}, nil
})
}
+1 -1
View File
@@ -33,7 +33,7 @@ func TestTaskNGrinder(t *testing.T) {
"clone": cloneId,
"username": "admin",
"passwd": "YWRtaW4=",
"pollInterval": "1",
"pollInterval": "1s",
}, canary, logger)
if err != nil {
t.Fatalf("Failed to create ngrinder task: %s", err.Error())