Atlas › Test

1

Exact test identity: go.temporal.io/server/common/backoff/TestCron/1

Package
go.temporal.io/server/common/backoff
Suite / test hierarchy
TestCron/1
Test
1
Introduced at
cron.go ×1 Frontier kind: Joint frontier
Covered ranges
6
Covered lines
25
Covered files
2

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/common/backoff/retrypolicy.go 19 covered LOC · 3 ranges

Open complete file

80
81 // NewExponentialRetryPolicy returns an instance of ExponentialRetryPolicy using the provided initialInterval
82 > func NewExponentialRetryPolicy(initialInterval time.Duration) *ExponentialRetryPolicy { retrypolicy.go
83 > p := &ExponentialRetryPolicy{
84 > initialInterval: initialInterval,
85 > backoffCoefficient: defaultBackoffCoefficient,
86 > maximumInterval: defaultMaximumInterval,
87 > expirationInterval: defaultExpirationInterval,
88 > maximumAttempts: defaultMaximumAttempts,
89 > }
90 >
91 > return p
92 > }
93
94 // NewRetrier is used for creating a new instance of Retrier
121 // This does *not* cause the policy to stop retrying when the interval between retries reaches the supplied duration.
122 // That is what WithExpirationInterval does. Instead, this prevents the interval from exceeding maximumInterval.
123 > func (p *ExponentialRetryPolicy) WithMaximumInterval(maximumInterval time.Duration) *ExponentialRetryPolicy { retrypolicy.go
124 > p.maximumInterval = maximumInterval
125 > return p
126 > }
127
128 // WithExpirationInterval sets the absolute expiration interval for all retries
129 > func (p *ExponentialRetryPolicy) WithExpirationInterval(expirationInterval time.Duration) *ExponentialRetryPolicy { retrypolicy.go
130 > p.expirationInterval = expirationInterval
131 > return p
132 > }
133
134 // WithMaximumAttempts sets the maximum number of retry attempts
go.temporal.io/server/common/backoff/cron.go 6 covered LOC · 3 ranges

Open complete file

13
14 // ValidateSchedule validates a cron schedule spec
15 > func ValidateSchedule(cronSchedule string) error { cron.go
16 > if cronSchedule == "" {
17 return nil
18 }
19 > schedule, err := cron.ParseStandard(cronSchedule) cron.go
20 > if err != nil {
21 > return serviceerror.NewInvalidArgument("invalid CronSchedule.") cron.go
22 > }
23 nextTime := schedule.Next(time.Now().UTC())
24 if nextTime.IsZero() {