From 3bd20ea2f1be58001dd6330a7763bed3d4221695 Mon Sep 17 00:00:00 2001 From: antirez Date: Wed, 15 Jun 2016 17:15:18 +0200 Subject: Test TOUCH and new TTL / TYPE behavior about object access time. --- tests/test_helper.tcl | 1 + tests/unit/introspection-2.tcl | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/unit/introspection-2.tcl diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index d31829480..5f114c5dc 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -46,6 +46,7 @@ set ::all_tests { unit/scripting unit/maxmemory unit/introspection + unit/introspection-2 unit/limits unit/obuf-limits unit/bitops diff --git a/tests/unit/introspection-2.tcl b/tests/unit/introspection-2.tcl new file mode 100644 index 000000000..350a8a016 --- /dev/null +++ b/tests/unit/introspection-2.tcl @@ -0,0 +1,23 @@ +start_server {tags {"introspection"}} { + test {TTL and TYPYE do not alter the last access time of a key} { + r set foo bar + after 3000 + r ttl foo + r type foo + assert {[r object idletime foo] >= 2} + } + + test {TOUCH alters the last access time of a key} { + r set foo bar + after 3000 + r touch foo + assert {[r object idletime foo] < 2} + } + + test {TOUCH returns the number of existing keys specified} { + r flushdb + r set key1 1 + r set key2 2 + r touch key0 key1 key2 key3 + } 2 +} -- cgit v1.2.1