~ubuntu-branches/ubuntu/jaunty/memcached/jaunty

« back to all changes in this revision

Viewing changes to t/flush-all.t

  • Committer: Bazaar Package Importer
  • Author(s): Jay Bonci
  • Date: 2007-05-02 11:35:42 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502113542-qpoxsq28fjb7s9wc
Tags: 1.2.1-1
* New upstream release (Closes: #405054)
* Fix to logfile output so logrotate will work (Closes: #417941)
* Listen in on localhost by default (Closes: #383660)
* Default configuration suggests nobody by default (Closes: #391351)
* Bumped policy version to 3.7.2.2 (No other changes)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
use strict;
 
4
use Test::More tests => 10;
 
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 "set foo 0 0 6\r\nfooval\r\n";
 
14
is(scalar <$sock>, "STORED\r\n", "stored foo");
 
15
 
 
16
mem_get_is($sock, "foo", "fooval");
 
17
print $sock "flush_all\r\n";
 
18
is(scalar <$sock>, "OK\r\n", "did flush_all");
 
19
mem_get_is($sock, "foo", undef);
 
20
 
 
21
# check that flush_all doesn't blow away items that immediately get set
 
22
print $sock "set foo 0 0 3\r\nnew\r\n";
 
23
is(scalar <$sock>, "STORED\r\n", "stored foo = 'new'");
 
24
mem_get_is($sock, "foo", 'new');
 
25
 
 
26
# and the other form, specifying a flush_all time...
 
27
my $expire = time() + 2;
 
28
print $sock "flush_all $expire\r\n";
 
29
is(scalar <$sock>, "OK\r\n", "did flush_all in future");
 
30
 
 
31
print $sock "set foo 0 0 4\r\n1234\r\n";
 
32
is(scalar <$sock>, "STORED\r\n", "stored foo = '1234'");
 
33
mem_get_is($sock, "foo", '1234');
 
34
sleep(2.2);
 
35
mem_get_is($sock, "foo", undef);