diff options
author | sergiocarlos <carloschilazo@gmail.com> | 2015-12-08 18:32:49 -0600 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2016-05-28 23:40:07 -0700 |
commit | 6895d23e48c6359402066a74c812b3f14be05100 (patch) | |
tree | 4eecbe1d9fd15fac04239464f46d2363a72bb427 /t/stats.t | |
parent | 1b13a586624e8e315f23a482691c9bfb3ab36d9b (diff) | |
download | memcached-6895d23e48c6359402066a74c812b3f14be05100.tar.gz |
Implement get_expired stats
Diffstat (limited to 't/stats.t')
-rwxr-xr-x | t/stats.t | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -1,7 +1,7 @@ #!/usr/bin/perl use strict; -use Test::More tests => 98; +use Test::More tests => 103; use FindBin qw($Bin); use lib "$Bin/lib"; use MemcachedTest; @@ -30,6 +30,7 @@ my $sock = $server->sock; ## STAT cmd_touch 0 ## STAT get_hits 0 ## STAT get_misses 0 +## STAT get_expired 0 ## STAT delete_misses 0 ## STAT delete_hits 0 ## STAT incr_misses 0 @@ -71,10 +72,10 @@ my $sock = $server->sock; my $stats = mem_stats($sock); # Test number of keys -is(scalar(keys(%$stats)), 53, "53 stats values"); +is(scalar(keys(%$stats)), 54, "54 stats values"); # Test initial state -foreach my $key (qw(curr_items total_items bytes cmd_get cmd_set get_hits evictions get_misses +foreach my $key (qw(curr_items total_items bytes cmd_get cmd_set get_hits evictions get_misses get_expired bytes_written delete_hits delete_misses incr_hits incr_misses decr_hits decr_misses listen_disabled_num lrutail_reflocked time_in_listen_disabled_us)) { is($stats->{$key}, 0, "initial $key is zero"); @@ -190,6 +191,7 @@ is(0, $stats->{'cmd_get'}); is(0, $stats->{'cmd_set'}); is(0, $stats->{'get_hits'}); is(0, $stats->{'get_misses'}); +is(0, $stats->{'get_expired'}); is(0, $stats->{'delete_misses'}); is(0, $stats->{'delete_hits'}); is(0, $stats->{'incr_misses'}); @@ -203,6 +205,15 @@ is(0, $stats->{'evictions'}); is(0, $stats->{'reclaimed'}); is(0, $stats->{'lrutail_reflocked'}); +# item expired +print $sock "set should_expire 0 1 6\r\nfooval\r\n"; +is(scalar <$sock>, "STORED\r\n", "set item to expire"); +sleep(2); +print $sock "get should_expire\r\n"; +is(scalar <$sock>, "END\r\n", "item not returned"); +my $stats = mem_stats($sock); +is(1, $stats->{'get_expired'}, "get_expired counter is 1"); + print $sock "flush_all\r\n"; is(scalar <$sock>, "OK\r\n", "flushed"); |