source: t/noreply.t @ 787337

Revision 787337, 900 bytes checked in by Tomash Brechko <tomash.brechko@…>, 4 years ago (diff)

Add t/noreply.t.

  • Property mode set to 100644
Line 
1use warnings;
2use strict;
3
4use Test::More;
5
6use FindBin;
7
8use lib "$FindBin::Bin";
9use Memd;
10
11if ($Memd::memd) {
12    if ($Memd::version_num >= 10205) {
13        plan tests => 3;
14    } else {
15        plan skip_all => 'memcached 1.2.5 is required for noreply mode';
16    }
17} else {
18    plan skip_all => 'Not connected';
19}
20
21
22use constant count => 100;
23
24my %params = %Memd::params;
25foreach my $h (@{$params{servers}}) {
26    $h->{noreply} = 1 if ref($h) eq 'HASH';
27}
28
29my $another_memd = new Cache::Memcached::Fast(\%params);
30
31my @keys = map { "noreply-$_" } (1..count);
32
33$another_memd->set_multi(map { [$_, $_] } @keys);
34my $res = $another_memd->get_multi(@keys);
35isa_ok($res, 'HASH');
36is(scalar keys %$res, scalar @keys, 'Number of entries in result');
37my $count = 0;
38foreach my $k (@keys) {
39    ++$count if exists $res->{$k} and $res->{$k} eq $k;
40}
41is($count, count);
42
43$another_memd->delete_multi(@keys);
Note: See TracBrowser for help on using the repository browser.