diff options
author | Trond Norbye <trond.norbye@gmail.com> | 2010-11-10 17:48:47 -0800 |
---|---|---|
committer | Trond Norbye <trond.norbye@gmail.com> | 2010-11-10 17:48:47 -0800 |
commit | 3e4332bd717ec78a6e2461ca4ff0cf3caff866e9 (patch) | |
tree | 6f7320312b0795cc9a17269f078ebb2dde7b4892 /t/issue_140.t | |
parent | 6d7b93586dce9c99f04370e9d08c7ae1997bdbfd (diff) | |
download | memcached-3e4332bd717ec78a6e2461ca4ff0cf3caff866e9.tar.gz |
Issue 140 - Fix age for items stats
Diffstat (limited to 't/issue_140.t')
-rw-r--r-- | t/issue_140.t | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/t/issue_140.t b/t/issue_140.t new file mode 100644 index 0000000..2c6151e --- /dev/null +++ b/t/issue_140.t @@ -0,0 +1,37 @@ +#!/usr/bin/perl + +use strict; +use Test::More tests => 7; +use FindBin qw($Bin); +use lib "$Bin/lib"; +use MemcachedTest; + +my $server = new_memcached(); +my $sock = $server->sock; + +print $sock "set a 0 0 1\r\na\r\n"; +is (scalar <$sock>, "STORED\r\n", "stored key"); + +my $stats = mem_stats($sock, "items"); +my $age = $stats->{"items:1:age"}; +isnt ($age, "0", "Age should not be zero"); + +print $sock "flush_all\r\n"; +is (scalar <$sock>, "OK\r\n", "items flushed"); + +my $stats = mem_stats($sock, "items"); +my $age = $stats->{"items:1:age"}; +is ($age, undef, "all should be gone"); + +print $sock "set a 0 1 1\r\na\r\n"; +is (scalar <$sock>, "STORED\r\n", "stored key"); + +my $stats = mem_stats($sock, "items"); +my $age = $stats->{"items:1:age"}; +isnt ($age, "0", "Age should not be zero"); + +sleep(2); + +my $stats = mem_stats($sock, "items"); +my $age = $stats->{"items:1:age"}; +is ($age, undef, "all should be gone"); |