26 lines
854 B
Go
26 lines
854 B
Go
package schedule
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
"time"
|
|
|
|
core "git.yuntuo.hk/k2safe/orbit/model"
|
|
"git.yuntuo.hk/k2safe/orbit/pulse/service"
|
|
)
|
|
|
|
func TestScheduleDoesNotSilentlyIgnoreTaskDelay(t *testing.T) {
|
|
in := Definition{
|
|
Rule: Rule{Kind: "FIXED_RATE", Timezone: "UTC", StartAt: time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC), IntervalMS: 1000},
|
|
Policy: Policy{Misfire: "SKIP", Overlap: "PARALLEL", CatchupLimit: 1, CatchupWindowMS: 30000, GraceMS: 1000},
|
|
Task: service.SubmitInput{QueueID: core.ID("11111111111111111111111111111111"), Handler: "object.prepare", HandlerVersion: "v1", PayloadVersion: "v1", Payload: json.RawMessage(`{}`)},
|
|
}
|
|
if _, err := Normalize(in); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
in.Task.DelayMS = 1
|
|
if _, err := Normalize(in); err == nil {
|
|
t.Fatal("schedule accepted a delay outside its firing rule")
|
|
}
|
|
}
|