|
Revision 509, 1.3 kB
(checked in by sgrimm, 3 years ago)
|
|
Merge multithreaded into trunk, commit #2 (first commit only did the
new files, not the modified ones.)
|
-
Property svn:executable set to
*
|
| Line | |
|---|
| 1 | #!/usr/bin/perl |
|---|
| 2 | |
|---|
| 3 | use strict; |
|---|
| 4 | use Test::More tests => 17; |
|---|
| 5 | use FindBin qw($Bin); |
|---|
| 6 | use lib "$Bin/lib"; |
|---|
| 7 | use MemcachedTest; |
|---|
| 8 | |
|---|
| 9 | my $server = new_memcached(); |
|---|
| 10 | my $sock = $server->sock; |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | ## Output looks like this: |
|---|
| 14 | ## |
|---|
| 15 | ## STAT pid 16293 |
|---|
| 16 | ## STAT uptime 7 |
|---|
| 17 | ## STAT time 1174419597 |
|---|
| 18 | ## STAT version 1.2.1 |
|---|
| 19 | ## STAT pointer_size 32 |
|---|
| 20 | ## STAT rusage_user 0.012998 |
|---|
| 21 | ## STAT rusage_system 0.119981 |
|---|
| 22 | ## STAT curr_items 0 |
|---|
| 23 | ## STAT total_items 0 |
|---|
| 24 | ## STAT bytes 0 |
|---|
| 25 | ## STAT curr_connections 1 |
|---|
| 26 | ## STAT total_connections 2 |
|---|
| 27 | ## STAT connection_structures 2 |
|---|
| 28 | ## STAT cmd_get 0 |
|---|
| 29 | ## STAT cmd_set 0 |
|---|
| 30 | ## STAT get_hits 0 |
|---|
| 31 | ## STAT get_misses 0 |
|---|
| 32 | ## STAT evictions 0 |
|---|
| 33 | ## STAT bytes_read 7 |
|---|
| 34 | ## STAT bytes_written 0 |
|---|
| 35 | ## STAT limit_maxbytes 67108864 |
|---|
| 36 | |
|---|
| 37 | my $stats = mem_stats($sock); |
|---|
| 38 | |
|---|
| 39 | # Test number of keys |
|---|
| 40 | is(scalar(keys(%$stats)), 22, "22 stats values"); |
|---|
| 41 | |
|---|
| 42 | # Test initial state |
|---|
| 43 | foreach my $key (qw(curr_items total_items bytes cmd_get cmd_set get_hits evictions get_misses bytes_written)) { |
|---|
| 44 | is($stats->{$key}, 0, "initial $key is zero"); |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | # Do some operations |
|---|
| 48 | |
|---|
| 49 | print $sock "set foo 0 0 6\r\nfooval\r\n"; |
|---|
| 50 | is(scalar <$sock>, "STORED\r\n", "stored foo"); |
|---|
| 51 | mem_get_is($sock, "foo", "fooval"); |
|---|
| 52 | |
|---|
| 53 | my $stats = mem_stats($sock); |
|---|
| 54 | |
|---|
| 55 | foreach my $key (qw(total_items curr_items cmd_get cmd_set get_hits)) { |
|---|
| 56 | is($stats->{$key}, 1, "after one set/one get $key is 1"); |
|---|
| 57 | } |
|---|