File: 53-timeout-length.t

package info (click to toggle)
libredis-fast-perl 0.37%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 504 kB
  • sloc: perl: 2,866; makefile: 7
file content (35 lines) | stat: -rw-r--r-- 744 bytes parent folder | download
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
use strict;
use warnings;
use Test::More;
use Test::Fatal;
use Redis::Fast;
use lib 't/tlib';
use Test::SpawnRedisServer;
use Time::HiRes qw/gettimeofday tv_interval/;

use constant SSL_AVAILABLE => eval { require IO::Socket::SSL };

my ( $c, $t, $srv ) = redis();
my $use_ssl = $t ? SSL_AVAILABLE : 0;

END {
    $c->() if $c;
    $t->() if $t;
}

my $redis = Redis::Fast->new(
    server          => $srv,
    name            => 'my_name_is_glorious',
    reconnect       => 1,
    write_timeout   => 1,
    ssl             => $use_ssl,
    SSL_verify_mode => 0,
);

my $start_time = [gettimeofday];
eval { $redis->blpop( "notakey", 5 ); };
my $elapsed = tv_interval($start_time);

cmp_ok( $elapsed, '>', 4, 'not too short' );

done_testing;