Update tests to reflect new CRON name (keydb.cron)

Former-commit-id: 83f585e30ab9d37408c79b74e2536664325a051f
This commit is contained in:
John Sully 2020-03-01 21:42:01 -05:00
parent 765ffea018
commit de3d796eb7

View File

@ -1,47 +1,47 @@
start_server {tags {"CRON"}} { start_server {tags {"CRON"}} {
test {cron singleshot past tense} { test {keydb.cron singleshot past tense} {
r flushall r flushall
r cron testjob single 0 1 {redis.call("incr", "testkey")} 1 testkey r keydb.cron testjob single 0 1 {redis.call("incr", "testkey")} 1 testkey
after 300 after 300
assert_equal 1 [r get testkey] assert_equal 1 [r get testkey]
assert_equal 0 [r exists testjob] assert_equal 0 [r exists testjob]
} }
test {cron repeat past tense next exec is in the future} { test {keydb.cron repeat past tense next exec is in the future} {
r flushall r flushall
r cron testjob repeat 0 1000000 {redis.call("incr", "testkey")} 1 testkey r keydb.cron testjob repeat 0 1000000 {redis.call("incr", "testkey")} 1 testkey
after 300 after 300
assert_equal 1 [r get testkey] assert_equal 1 [r get testkey]
assert_equal 1 [r exists testjob] assert_equal 1 [r exists testjob]
r del testjob r del testjob
} }
test {cron repeat works} { test {keydb.cron repeat works} {
r flushall r flushall
r cron testjob repeat 0 600 {redis.call("incr","testkey")} r keydb.cron testjob repeat 0 600 {redis.call("incr","testkey")}
after 1000 after 1000
assert_equal 2 [r get testkey] assert_equal 2 [r get testkey]
} }
test {cron overwrite works} { test {keydb.cron overwrite works} {
r flushall r flushall
r cron testjob single 500 {redis.call("set","testkey","a")} 1 testkey r keydb.cron testjob single 500 {redis.call("set","testkey","a")} 1 testkey
r cron testjob single 500 {redis.call("set","anotherkey","b")} 1 anotherkey r keydb.cron testjob single 500 {redis.call("set","anotherkey","b")} 1 anotherkey
after 1000 after 1000
assert_equal 0 [r exists testkey] assert_equal 0 [r exists testkey]
assert_equal b [r get anotherkey] assert_equal b [r get anotherkey]
} }
test {cron delete key stops job} { test {keydb.cron delete key stops job} {
r flushall r flushall
r cron testjob single 500 {redis.call("set","testkey","a")} r keydb.cron testjob single 500 {redis.call("set","testkey","a")}
r del testjob r del testjob
after 1000 after 1000
assert_equal 0 [r exists testkey] assert_equal 0 [r exists testkey]
} }
test {cron zero interval rejected} { test {keydb.cron zero interval rejected} {
catch {r cron testjob single 0 0 {redis.call("incr","testkey")} 1 testkey} e catch {r keydb.cron testjob single 0 0 {redis.call("incr","testkey")} 1 testkey} e
assert_match {ERR*} $e assert_match {ERR*} $e
} }
} }