File: issue_140.t

package info (click to toggle)
memcached 1.4.21-1.1%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 2,308 kB
  • ctags: 1,954
  • sloc: ansic: 10,385; sh: 4,359; perl: 4,054; xml: 1,634; makefile: 148
file content (41 lines) | stat: -rw-r--r-- 974 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/perl

use strict;
use Test::More;
use FindBin qw($Bin);
use lib "$Bin/lib";
use MemcachedTest;

plan skip_all => 'Fix for Issue 140 was only an illusion';

plan tests => 7;

my $server = new_memcached();
my $sock = $server->sock;

print $sock "set a 0 0 1\r\na\r\n";
is (scalar <$sock>, "STORED\r\n", "stored key");

my $stats  = mem_stats($sock, "items");
my $age = $stats->{"items:1:age"};
isnt ($age, "0", "Age should not be zero");

print $sock "flush_all\r\n";
is (scalar <$sock>, "OK\r\n", "items flushed");

my $stats  = mem_stats($sock, "items");
my $age = $stats->{"items:1:age"};
is ($age, undef, "all should be gone");

print $sock "set a 0 1 1\r\na\r\n";
is (scalar <$sock>, "STORED\r\n", "stored key");

my $stats  = mem_stats($sock, "items");
my $age = $stats->{"items:1:age"};
isnt ($age, "0", "Age should not be zero");

sleep(3);

my $stats  = mem_stats($sock, "items");
my $age = $stats->{"items:1:age"};
is ($age, undef, "all should be gone");