summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorTrond Norbye <Trond.Norbye@sun.com>2009-10-29 19:53:52 +0100
committerDustin Sallings <dustin@spy.net>2009-10-29 14:03:29 -0700
commitb1001be042a5b078bfc00a87fec1467f12045323 (patch)
tree0e2393897af4563feafce8f4bcd310258088dc45 /t
parentac37e81c6ca3cb99dac9885d06d19a804ebc7a49 (diff)
downloadmemcached-b1001be042a5b078bfc00a87fec1467f12045323.tar.gz
Issue 104: stats bug for cmd_get
Diffstat (limited to 't')
-rwxr-xr-xt/issue_104.t24
1 files changed, 24 insertions, 0 deletions
diff --git a/t/issue_104.t b/t/issue_104.t
new file mode 100755
index 0000000..2213f69
--- /dev/null
+++ b/t/issue_104.t
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::More tests => 6;
+use FindBin qw($Bin);
+use lib "$Bin/lib";
+use MemcachedTest;
+
+my $server = new_memcached();
+my $sock = $server->sock;
+
+# first get should miss
+print $sock "get foo\r\n";
+is(scalar <$sock>, "END\r\n", "get foo");
+
+# Now set and get (should hit)
+print $sock "set foo 0 0 6\r\nfooval\r\n";
+is(scalar <$sock>, "STORED\r\n", "stored foo");
+mem_get_is($sock, "foo", "fooval");
+
+my $stats = mem_stats($sock);
+is($stats->{cmd_get}, 2, "Should have 2 get requests");
+is($stats->{get_hits}, 1, "Should have 1 hit");
+is($stats->{get_misses}, 1, "Should have 1 miss");