Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 53 lines (41 sloc) 1.212 kb
4ad4579 @dormando Tests for item_size_max (-I) setting.
dormando authored
1 #!/usr/bin/perl
2
3 use strict;
4 use Test::More tests => 7;
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 my $stats = mem_stats($sock, ' settings');
13
14 # Ensure default still works.
15 is($stats->{item_size_max}, 1024 * 1024);
16 $server->stop();
17
18 # Should die.
19 eval {
20 $server = new_memcached('-I 1000');
21 };
22 ok($@ && $@ =~ m/^Failed/, "Shouldn't start with < 1k item max");
23
24 eval {
25 $server = new_memcached('-I 256m');
26 };
27 ok($@ && $@ =~ m/^Failed/, "Shouldn't start with > 128m item max");
28
29 # Minimum.
30 $server = new_memcached('-I 1024');
31 my $stats = mem_stats($server->sock, ' settings');
32 is($stats->{item_size_max}, 1024);
33 $server->stop();
34
35 # Reasonable but unreasonable.
36 $server = new_memcached('-I 1049600');
37 my $stats = mem_stats($server->sock, ' settings');
38 is($stats->{item_size_max}, 1049600);
39 $server->stop();
40
41 # Suffix kilobytes.
42 $server = new_memcached('-I 512k');
43 my $stats = mem_stats($server->sock, ' settings');
44 is($stats->{item_size_max}, 524288);
45 $server->stop();
46
47 # Suffix megabytes.
48 $server = new_memcached('-I 32m');
49 my $stats = mem_stats($server->sock, ' settings');
50 is($stats->{item_size_max}, 33554432);
51 $server->stop();
52
Something went wrong with that request. Please try again.