mirror of
https://github.com/fluxcd/flagger.git
synced 2026-04-15 06:57:34 +00:00
support time duration literal
This commit is contained in:
@@ -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
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user