diff options
author | dormando <dormando@rydia.net> | 2016-07-01 14:41:29 -0700 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2016-07-12 18:42:46 -0700 |
commit | b05653f9a8ab3ee70431ef83a136e15f22e617ea (patch) | |
tree | dedd967f3f5ef7e69b1c4943ead0b64722a419ec /t/chunked-items.t | |
parent | 0567967a925faf4e0a6bb7a181ab5aa1eff2272e (diff) | |
download | memcached-b05653f9a8ab3ee70431ef83a136e15f22e617ea.tar.gz |
chunked item second checkpoint
can actually fetch items now, and fixed a few bugs with storage/freeing.
added fetching for binprot.
added some basic tests.
many tests still fail for various reasons, and append/prepend isn't fixed yet.
Diffstat (limited to 't/chunked-items.t')
-rw-r--r-- | t/chunked-items.t | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/t/chunked-items.t b/t/chunked-items.t new file mode 100644 index 0000000..b375741 --- /dev/null +++ b/t/chunked-items.t @@ -0,0 +1,54 @@ +#!/usr/bin/perl +# Networked logging tests. + +use strict; +use warnings; + +use Test::More; +use FindBin qw($Bin); +use lib "$Bin/lib"; +use MemcachedTest; + +my $server = new_memcached('-m 48'); +my $sock = $server->sock; + +# We're testing to ensure item chaining doesn't corrupt or poorly overlap +# data, so create a non-repeating pattern. +my @parts = (); +for (1 .. 4000) { + push(@parts, $_); +} +my $pattern = join(':', @parts); + +my $plen = length($pattern); +print STDERR "PATTERN LENGTH: $plen\n"; + +print $sock "set pattern 0 0 $plen\r\n$pattern\r\n"; +is(scalar <$sock>, "STORED\r\n", "stored pattern successfully"); + +mem_get_is($sock, "pattern", $pattern); + +for (1..5) { + my $size = 400 * 1024; + my $data = "x" x $size; + print $sock "set foo$_ 0 0 $size\r\n$data\r\n"; + my $res = <$sock>; + is($res, "STORED\r\n", "stored some big items"); +} + +{ + my $max = 1024 * 1024; + my $big = "a big value that's > .5M and < 1M. "; + while (length($big) * 2 < $max) { + $big = $big . $big; + } + my $biglen = length($big); + + for (1..100) { + print $sock "set toast$_ 0 0 $biglen\r\n$big\r\n"; + is(scalar <$sock>, "STORED\r\n", "stored big"); + mem_get_is($sock, "toast$_", $big); + } +} + +done_testing(); |