~yolanda.robla/ubuntu/trusty/memcached/add_distribution

« back to all changes in this revision

Viewing changes to t/issue_140.t

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2011-10-05 13:27:39 UTC
  • mfrom: (1.1.8 upstream) (3.3.4 sid)
  • Revision ID: james.westby@ubuntu.com-20111005132739-ntsnlj16fcze221i
Tags: 1.4.7-0.1ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Run as 'memcache' user instead of nobody (LP #599461)
  - Depend on adduser for preinst/postrm
  - Create user in postinst

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 => 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
print $sock "set a 0 0 1\r\na\r\n";
 
13
is (scalar <$sock>, "STORED\r\n", "stored key");
 
14
 
 
15
my $stats  = mem_stats($sock, "items");
 
16
my $age = $stats->{"items:1:age"};
 
17
isnt ($age, "0", "Age should not be zero");
 
18
 
 
19
print $sock "flush_all\r\n";
 
20
is (scalar <$sock>, "OK\r\n", "items flushed");
 
21
 
 
22
my $stats  = mem_stats($sock, "items");
 
23
my $age = $stats->{"items:1:age"};
 
24
is ($age, undef, "all should be gone");
 
25
 
 
26
print $sock "set a 0 1 1\r\na\r\n";
 
27
is (scalar <$sock>, "STORED\r\n", "stored key");
 
28
 
 
29
my $stats  = mem_stats($sock, "items");
 
30
my $age = $stats->{"items:1:age"};
 
31
isnt ($age, "0", "Age should not be zero");
 
32
 
 
33
sleep(3);
 
34
 
 
35
my $stats  = mem_stats($sock, "items");
 
36
my $age = $stats->{"items:1:age"};
 
37
is ($age, undef, "all should be gone");