File: 53-deep-recursion.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 (53 lines) | stat: -rwxr-xr-x 1,110 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!perl

use warnings;
use strict;
use Test::More;
use Test::Fatal;
use Redis::Fast;
use lib 't/tlib';
use Test::SpawnRedisServer;

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

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

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

ok my $r1 = Redis::Fast->new(
    server => $srv,
    name          => 'my-first-connection',
    reconnect     => 1,
    every         => 1000,
    on_connect => sub {
        my ( $redis ) = @_;
        $redis->select(1);
    },
    ssl => $use_ssl,
    SSL_verify_mode => 0,
), "first connection is success";

like(
  exception {
      my $r2 = Redis::Fast->new(
          server => $srv,
          name          => 'my-second-connection',
          reconnect     => 1,
          every         => 1000,
          on_connect => sub {
              my ( $redis ) = @_;
              $redis->select(1);
          },
        ssl => $use_ssl,
        SSL_verify_mode => 0,
      );
  },
  qr/Could not connect to Redis server at/, 'second connection is fail',
);

## All done
done_testing();