"Fossies" - the Fresh Open Source Software Archive

Member "memcached-1.6.15/t/stats-detail.t" (16 Jul 2020, 2117 Bytes) of package /linux/www/memcached-1.6.15.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/perl
    2 
    3 use strict;
    4 use Test::More tests => 24;
    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 my $expire;
   12 
   13 print $sock "stats detail dump\r\n";
   14 is(scalar <$sock>, "END\r\n", "verified empty stats at start");
   15 
   16 print $sock "stats detail on\r\n";
   17 is(scalar <$sock>, "OK\r\n", "detail collection turned on");
   18 
   19 print $sock "set foo:123 0 0 6\r\nfooval\r\n";
   20 is(scalar <$sock>, "STORED\r\n", "stored foo");
   21 
   22 print $sock "stats detail dump\r\n";
   23 is(scalar <$sock>, "PREFIX foo get 0 hit 0 set 1 del 0\r\n", "details after set");
   24 is(scalar <$sock>, "END\r\n", "end of details");
   25 
   26 mem_get_is($sock, "foo:123", "fooval");
   27 print $sock "stats detail dump\r\n";
   28 is(scalar <$sock>, "PREFIX foo get 1 hit 1 set 1 del 0\r\n", "details after get with hit");
   29 is(scalar <$sock>, "END\r\n", "end of details");
   30 
   31 mem_get_is($sock, "foo:124", undef);
   32 
   33 print $sock "stats detail dump\r\n";
   34 is(scalar <$sock>, "PREFIX foo get 2 hit 1 set 1 del 0\r\n", "details after get without hit");
   35 is(scalar <$sock>, "END\r\n", "end of details");
   36 
   37 print $sock "delete foo:125\r\n";
   38 is(scalar <$sock>, "NOT_FOUND\r\n", "sent delete command");
   39 
   40 print $sock "stats detail dump\r\n";
   41 is(scalar <$sock>, "PREFIX foo get 2 hit 1 set 1 del 1\r\n", "details after delete");
   42 is(scalar <$sock>, "END\r\n", "end of details");
   43 
   44 print $sock "stats reset\r\n";
   45 is(scalar <$sock>, "RESET\r\n", "stats cleared");
   46 
   47 print $sock "stats detail dump\r\n";
   48 is(scalar <$sock>, "END\r\n", "empty stats after clear");
   49 
   50 mem_get_is($sock, "foo:123", "fooval");
   51 print $sock "stats detail dump\r\n";
   52 is(scalar <$sock>, "PREFIX foo get 1 hit 1 set 0 del 0\r\n", "details after clear and get");
   53 is(scalar <$sock>, "END\r\n", "end of details");
   54 
   55 print $sock "stats detail off\r\n";
   56 is(scalar <$sock>, "OK\r\n", "detail collection turned off");
   57 
   58 mem_get_is($sock, "foo:124", undef);
   59 
   60 mem_get_is($sock, "foo:123", "fooval");
   61 print $sock "stats detail dump\r\n";
   62 is(scalar <$sock>, "PREFIX foo get 1 hit 1 set 0 del 0\r\n", "details after stats turned off");
   63 is(scalar <$sock>, "END\r\n", "end of details");