Create crond scheduler and dependencies and store to disk

This commit is contained in:
bel
2020-03-12 15:14:25 -06:00
parent f022b26987
commit 65655080dd
12 changed files with 514 additions and 0 deletions

36
scheduler/parser_test.go Normal file
View File

@@ -0,0 +1,36 @@
package scheduler
import "testing"
func TestValidCronFail(t *testing.T) {
cases := []string{
"a 1 1 1 1",
"1 1 1 1",
"1 1 1 1 1 1",
"@minutely",
}
for _, c := range cases {
if validCron(c) {
t.Error("should fail:", c)
}
}
}
func TestValidCronPass(t *testing.T) {
cases := []string{
"1 1 1 1 1",
"* * 1 1 1",
"@hourly",
"@daily",
"@yearly",
"@weekly",
"* */5 1 1 1",
}
for _, c := range cases {
if !validCron(c) {
t.Error("should pass:", c)
}
}
}