mirror of
https://github.com/kopia/kopia.git
synced 2026-03-05 14:57:36 -05:00
fix(server): Respect manual scheduling policy (#2464)
* fix(server): respect manual scheduling policy * Added test
This commit is contained in:
committed by
GitHub
parent
bd49fa806a
commit
11ce91dd5a
@@ -81,6 +81,10 @@ func (p *SchedulingPolicy) SetInterval(d time.Duration) {
|
||||
// NextSnapshotTime computes next snapshot time given previous
|
||||
// snapshot time and current wall clock time.
|
||||
func (p *SchedulingPolicy) NextSnapshotTime(previousSnapshotTime, now time.Time) (time.Time, bool) {
|
||||
if p.Manual {
|
||||
return time.Time{}, false
|
||||
}
|
||||
|
||||
const oneDay = 24 * time.Hour
|
||||
|
||||
var (
|
||||
|
||||
@@ -162,6 +162,17 @@ func TestNextSnapshotTime(t *testing.T) {
|
||||
wantTime: time.Date(2020, time.January, 1, 19, 0, 0, 0, time.Local),
|
||||
wantOK: true,
|
||||
},
|
||||
{
|
||||
pol: policy.SchedulingPolicy{
|
||||
IntervalSeconds: 43200,
|
||||
TimesOfDay: []policy.TimeOfDay{{19, 0}, {20, 0}},
|
||||
Manual: true,
|
||||
},
|
||||
previousSnapshotTime: time.Date(2020, time.January, 1, 19, 0, 0, 0, time.Local),
|
||||
now: time.Date(2020, time.January, 1, 10, 0, 0, 0, time.Local),
|
||||
wantTime: time.Time{},
|
||||
wantOK: false,
|
||||
},
|
||||
}
|
||||
|
||||
for i, tc := range cases {
|
||||
|
||||
Reference in New Issue
Block a user