"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "t/stats.t" between
memcached-1.6.12.tar.gz and memcached-1.6.13.tar.gz

About: memcached is a high-performance, distributed memory object caching system, generic in nature, but originally intended for use in speeding up dynamic web applications by alleviating database load.

stats.t  (memcached-1.6.12):stats.t  (memcached-1.6.13)
#!/usr/bin/perl #!/usr/bin/perl
use strict; use strict;
use Test::More tests => 109; use Test::More tests => 113;
use FindBin qw($Bin); use FindBin qw($Bin);
use lib "$Bin/lib"; use lib "$Bin/lib";
use MemcachedTest; use MemcachedTest;
my $server = new_memcached("-o no_lru_crawler,no_lru_maintainer"); my $server = new_memcached("-I 1024 -o slab_chunk_max=1024,no_lru_crawler,no_lru _maintainer");
my $sock = $server->sock; my $sock = $server->sock;
## Output looks like this: ## Output looks like this:
## ##
## STAT pid 22969 ## STAT pid 22969
## STAT uptime 13 ## STAT uptime 13
## STAT time 1259170891 ## STAT time 1259170891
## STAT version 1.4.3 ## STAT version 1.4.3
## STAT libevent 1.4.13-stable. ## STAT libevent 1.4.13-stable.
## see doc/protocol.txt for others ## see doc/protocol.txt for others
# note that auth stats are tested in auth specific tests # note that auth stats are tested in auth specific tests
my $stats = mem_stats($sock); my $stats = mem_stats($sock);
# Test number of keys # Test number of keys
if (MemcachedTest::enabled_tls_testing()) { if (MemcachedTest::enabled_tls_testing()) {
# when TLS is enabled, stats contains additional keys: # when TLS is enabled, stats contains additional keys:
# - ssl_handshake_errors # - ssl_handshake_errors
# - time_since_server_cert_refresh # - time_since_server_cert_refresh
is(scalar(keys(%$stats)), 83, "expected count of stats values"); is(scalar(keys(%$stats)), 85, "expected count of stats values");
} else { } else {
is(scalar(keys(%$stats)), 81, "expected count of stats values"); is(scalar(keys(%$stats)), 83, "expected count of stats values");
} }
# Test initial state # Test initial state
foreach my $key (qw(curr_items total_items bytes cmd_get cmd_set get_hits evicti ons get_misses get_expired foreach my $key (qw(curr_items total_items bytes cmd_get cmd_set get_hits evicti ons get_misses get_expired
bytes_written delete_hits delete_misses incr_hits incr_misses d ecr_hits get_flushed bytes_written delete_hits delete_misses incr_hits incr_misses d ecr_hits get_flushed
decr_misses listen_disabled_num lrutail_reflocked time_in_liste decr_misses listen_disabled_num lrutail_reflocked time_in_liste
n_disabled_us)) { n_disabled_us
store_too_large store_no_memory)) {
is($stats->{$key}, 0, "initial $key is zero"); is($stats->{$key}, 0, "initial $key is zero");
} }
is($stats->{accepting_conns}, 1, "initial accepting_conns is one"); is($stats->{accepting_conns}, 1, "initial accepting_conns is one");
# Do some operations # Do some operations
print $sock "set foo 0 0 6\r\nfooval\r\n"; print $sock "set foo 0 0 6\r\nfooval\r\n";
is(scalar <$sock>, "STORED\r\n", "stored foo"); is(scalar <$sock>, "STORED\r\n", "stored foo");
mem_get_is($sock, "foo", "fooval"); mem_get_is($sock, "foo", "fooval");
skipping to change at line 191 skipping to change at line 192
print $sock "set should_be_flushed 0 0 6\r\nbooval\r\n"; print $sock "set should_be_flushed 0 0 6\r\nbooval\r\n";
is(scalar <$sock>, "STORED\r\n", "set item to flush"); is(scalar <$sock>, "STORED\r\n", "set item to flush");
print $sock "flush_all\r\n"; print $sock "flush_all\r\n";
is(scalar <$sock>, "OK\r\n", "flushed"); is(scalar <$sock>, "OK\r\n", "flushed");
print $sock "get should_be_flushed\r\n"; print $sock "get should_be_flushed\r\n";
is(scalar <$sock>, "END\r\n", "flushed item not returned"); is(scalar <$sock>, "END\r\n", "flushed item not returned");
my $stats = mem_stats($sock); my $stats = mem_stats($sock);
is($stats->{cmd_flush}, 1, "after one flush cmd_flush is 1"); is($stats->{cmd_flush}, 1, "after one flush cmd_flush is 1");
is($stats->{get_flushed}, 1, "after flush and a get, get_flushed is 1"); is($stats->{get_flushed}, 1, "after flush and a get, get_flushed is 1");
# item too large
my $large = "B" x 2048;
my $largelen = length($large);
print $sock "set too_large 0 0 $largelen\r\n$large\r\n";
is(scalar <$sock>, "SERVER_ERROR object too large for cache\r\n",
"set rejected due to value too large");
$stats = mem_stats($sock);
is($stats->{'store_too_large'}, 1,
"recorded store failure due to value too large")
 End of changes. 6 change blocks. 
6 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)