File: 53-fail-to-connect.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 (30 lines) | stat: -rw-r--r-- 676 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
use strict;
use warnings;
use Config;
use Test::More;
use Test::Fatal;
use Redis::Fast;

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

like exception {
    Redis::Fast->new(server => "localhost:0", ssl => SSL_AVAILABLE, SSL_verify_mode => 0);
}, qr/could not connect to redis server/i, 'fail to connect';

my $redis = Redis::Fast->new(
   reconnect => 0,
   every => 50_000,
   no_auto_connect_on_new => 1,
   server => '127.0.0.1:6379',
   write_timeout => 0.2,
   read_timeout => 0.2,
   cnx_timeout => 0.2,
   ssl => SSL_AVAILABLE,
   SSL_verify_mode => 0,
);

eval { $redis->info(); };
eval { $redis->info(); };
eval { $redis->info(); };

done_testing;