mirror of
https://github.com/rclone/rclone.git
synced 2025-08-15 16:22:47 +02:00
config: make parsing of duration options consistent
All user visible Durations should be fs.Duration rather than time.Duration. Suffix is then optional and defaults to s. Additional suffices d, w, M and y are supported, in addition to ms, s, m and h - which are the only ones supported by time.Duration. Absolute times can also be specified, and will be interpreted as duration relative to now.
This commit is contained in:
@ -1467,7 +1467,7 @@ func TestSyncWithUpdateOlder(t *testing.T) {
|
||||
r.CheckRemoteItems(t, oneO, twoO, threeO, fourO)
|
||||
|
||||
ci.UpdateOlder = true
|
||||
ci.ModifyWindow = fs.ModTimeNotSupported
|
||||
ci.ModifyWindow = fs.Duration(fs.ModTimeNotSupported)
|
||||
|
||||
ctx = predictDstFromLogger(ctx)
|
||||
err := Sync(ctx, r.Fremote, r.Flocal, false)
|
||||
@ -1497,7 +1497,7 @@ func testSyncWithMaxDuration(t *testing.T, cutoffMode fs.CutoffMode) {
|
||||
}
|
||||
r := fstest.NewRun(t)
|
||||
|
||||
maxDuration := 250 * time.Millisecond
|
||||
maxDuration := fs.Duration(250 * time.Millisecond)
|
||||
ci.MaxDuration = maxDuration
|
||||
ci.CutoffMode = cutoffMode
|
||||
ci.CheckFirst = true
|
||||
@ -1539,7 +1539,7 @@ func testSyncWithMaxDuration(t *testing.T, cutoffMode fs.CutoffMode) {
|
||||
const maxTransferTime = 20 * time.Second
|
||||
|
||||
what := fmt.Sprintf("expecting elapsed time %v between %v and %v", elapsed, maxDuration, maxTransferTime)
|
||||
assert.True(t, elapsed >= maxDuration, what)
|
||||
assert.True(t, elapsed >= time.Duration(maxDuration), what)
|
||||
assert.True(t, elapsed < maxTransferTime, what)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user