summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2009-03-25 00:55:19 -0700
committerDustin Sallings <dustin@spy.net>2009-03-30 14:06:31 -0700
commit534466e0dcbc7e385585ebd456a35d0beded2f47 (patch)
tree01f5045ea4e4bf1ad0f97c353c844005c1abbd42 /t
parentb8d997e532ffbb562d01f82bc19e09dd5f106195 (diff)
downloadmemcached-534466e0dcbc7e385585ebd456a35d0beded2f47.tar.gz
add a cmd_flush stat
shouldn't add much lock contention for just this. I want to add this one stat (mayb a few more?) since it's happened more than once that folks think memcached is broken when a cron or something is calling 'flush_all' once a minute.
Diffstat (limited to 't')
-rwxr-xr-xt/stats.t15
1 files changed, 12 insertions, 3 deletions
diff --git a/t/stats.t b/t/stats.t
index 93ee639..bc0c198 100755
--- a/t/stats.t
+++ b/t/stats.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use strict;
-use Test::More tests => 89;
+use Test::More tests => 91;
use FindBin qw($Bin);
use lib "$Bin/lib";
use MemcachedTest;
@@ -25,6 +25,7 @@ my $sock = $server->sock;
## STAT curr_connections 1
## STAT total_connections 2
## STAT connection_structures 2
+## STAT cmd_flush 0
## STAT cmd_get 0
## STAT cmd_set 0
## STAT get_hits 0
@@ -46,10 +47,12 @@ my $sock = $server->sock;
my $stats = mem_stats($sock);
# Test number of keys
-is(scalar(keys(%$stats)), 31, "31 stats values");
+is(scalar(keys(%$stats)), 32, "32 stats values");
# Test initial state
-foreach my $key (qw(curr_items total_items bytes cmd_get cmd_set get_hits evictions get_misses bytes_written delete_hits delete_misses incr_hits incr_misses decr_hits decr_misses)) {
+foreach my $key (qw(curr_items total_items bytes cmd_get cmd_set get_hits evictions get_misses
+ bytes_written delete_hits delete_misses incr_hits incr_misses decr_hits
+ decr_misses)) {
is($stats->{$key}, 0, "initial $key is zero");
}
@@ -171,3 +174,9 @@ is(0, $stats->{'cas_misses'});
is(0, $stats->{'cas_hits'});
is(0, $stats->{'cas_badval'});
is(0, $stats->{'evictions'});
+
+print $sock "flush_all\r\n";
+is(scalar <$sock>, "OK\r\n", "flushed");
+
+my $stats = mem_stats($sock);
+is($stats->{cmd_flush}, 1, "after one flush cmd_flush is 1");