Permalink
Browse files

Added basic -M test.

  • Loading branch information...
1 parent 88bcc85 commit 95812e25f5012e78b544463b84aae6ae5d0de95a @dustin dustin committed Mar 19, 2009
Showing with 34 additions and 0 deletions.
  1. +34 −0 t/dash-M.t
View
34 t/dash-M.t
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::More;
+use FindBin qw($Bin);
+use lib "$Bin/lib";
+use MemcachedTest;
+
+my $server = new_memcached('-M -m 1');
+my $sock = $server->sock;
+
+my $value = "B" x 8192;
+my $vallen = length($value);
+
+my $resp = "STORED\r\n";
+my $key = 0;
+
+while($resp eq "STORED\r\n") {
+ print $sock "set dash$key 0 0 $vallen\r\n$value\r\n";
+ $key++;
+ $resp = scalar <$sock>;
+}
+
+my $max_stored = $key - 1;
+
+plan tests => $max_stored + 1;
+
+print $sock "set dash$key 0 0 $vallen\r\n$value\r\n";
+is(scalar <$sock>, "SERVER_ERROR out of memory storing object\r\n",
+ "failed to add another one.");
+
+for($key = 0; $key < $max_stored; $key++) {
+ mem_get_is $sock, "dash$key", $value, "Failed at dash$key";
+}

0 comments on commit 95812e2

Please sign in to comment.