"Fossies" - the Fresh Open Source Software Archive

Member "memcached-1.6.15/t/00-startup.t" (21 Feb 2022, 2131 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 => 21;
    5 use FindBin qw($Bin);
    6 use lib "$Bin/lib";
    7 use MemcachedTest;
    8 
    9 eval {
   10     my $server = new_memcached();
   11     ok($server, "started the server");
   12 };
   13 is($@, '', 'Basic startup works');
   14 
   15 eval {
   16     my $server = new_memcached("-l fooble");
   17 };
   18 ok($@, "Died with illegal -l args");
   19 
   20 eval {
   21     my $server = new_memcached("-l 127.0.0.1");
   22 };
   23 is($@,'', "-l 127.0.0.1 works");
   24 
   25 eval {
   26     my $server = new_memcached('-C');
   27     my $stats = mem_stats($server->sock, 'settings');
   28     is('no', $stats->{'cas_enabled'});
   29 };
   30 is($@, '', "-C works");
   31 
   32 eval {
   33     my $server = new_memcached('-b 8675');
   34     my $stats = mem_stats($server->sock, 'settings');
   35     is('8675', $stats->{'tcp_backlog'});
   36 };
   37 is($@, '', "-b works");
   38 
   39 foreach my $val ('auto', 'ascii') {
   40     eval {
   41         my $server = new_memcached("-B $val");
   42         my $stats = mem_stats($server->sock, 'settings');
   43         ok($stats->{'binding_protocol'} =~ /$val/, "$val works");
   44     };
   45     is($@, '', "$val works");
   46 }
   47 
   48 # For the binary test, we just verify it starts since we don't have an easy bin client.
   49 eval {
   50     my $server = new_memcached("-B binary");
   51 };
   52 is($@, '', "binary works");
   53 
   54 eval {
   55     my $server = new_memcached("-vv -B auto");
   56 };
   57 is($@, '', "auto works");
   58 
   59 eval {
   60     my $server = new_memcached("-vv -B ascii");
   61 };
   62 is($@, '', "ascii works");
   63 
   64 
   65 # For the binary test, we just verify it starts since we don't have an easy bin client.
   66 eval {
   67     my $server = new_memcached("-vv -B binary");
   68 };
   69 is($@, '', "binary works");
   70 
   71 
   72 # Should blow up with something invalid.
   73 eval {
   74     my $server = new_memcached("-B http");
   75 };
   76 ok($@, "Died with illegal -B arg.");
   77 
   78 # Maximum connections must be greater than 0.
   79 eval {
   80     my $server = new_memcached("-c 0");
   81 };
   82 ok($@, "Died with invalid maximum connections 0.");
   83 eval {
   84     my $server = new_memcached("-c -1");
   85 };
   86 ok($@, "Died with invalid maximum connections -1.");
   87 
   88 # Should not allow -t 0
   89 eval {
   90     my $server = new_memcached("-t 0");
   91 };
   92 ok($@, "Died with illegal 0 thread count");
   93 
   94 {
   95     my $exit_code = run_help();
   96     is($exit_code, 0, "Help defaults are fine.");
   97 };