feat: add durable relative task delays and outage recovery regression
This commit is contained in:
@@ -24,7 +24,14 @@ func TestSubmitNormalizationAndBounds(t *testing.T) {
|
||||
"unbounded attempts": func(v *SubmitInput) { v.Retry.MaxAttempts = 101 },
|
||||
"unknown recovery policy": func(v *SubmitInput) { v.RecoverySafety = "UNKNOWN" },
|
||||
"excess timeout": func(v *SubmitInput) { v.TaskTimeoutMS = 30*86400000 + 1 },
|
||||
"sub-microsecond time": func(v *SubmitInput) { now := time.Date(2026, 1, 1, 0, 0, 0, 1, time.UTC); v.AvailableAt = &now },
|
||||
"delay equals deadline": func(v *SubmitInput) { v.DelayMS = 86400000 },
|
||||
"delay overflow": func(v *SubmitInput) { v.DelayMS = ^uint64(0) },
|
||||
"both timing modes": func(v *SubmitInput) {
|
||||
now := time.Now().UTC().Truncate(time.Microsecond)
|
||||
v.AvailableAt = &now
|
||||
v.DelayMS = 1
|
||||
},
|
||||
"sub-microsecond time": func(v *SubmitInput) { now := time.Date(2026, 1, 1, 0, 0, 0, 1, time.UTC); v.AvailableAt = &now },
|
||||
} {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
in := base
|
||||
@@ -34,6 +41,10 @@ func TestSubmitNormalizationAndBounds(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
base.DelayMS = 86400000 - 1
|
||||
if out, err := NormalizeSubmit(base); err != nil || out.DelayMS != base.DelayMS || out.AvailableAt != nil {
|
||||
t.Fatal("relative delay was resolved before database acceptance", err)
|
||||
}
|
||||
for _, key := range []string{"", strings.Repeat("a", 129), "with space", "带中文", "line\n"} {
|
||||
if ValidateKey(key) == nil {
|
||||
t.Fatal("accepted invalid key")
|
||||
|
||||
Reference in New Issue
Block a user