~ubuntu-branches/ubuntu/oneiric/libanyevent-redis-perl/oneiric

« back to all changes in this revision

Viewing changes to t/reconnect.t

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghedini
  • Date: 2011-02-09 19:31:48 UTC
  • Revision ID: james.westby@ubuntu.com-20110209193148-asa3jeyaol6nikd2
Tags: upstream-0.23
ImportĀ upstreamĀ versionĀ 0.23

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use strict;
 
2
use Test::More;
 
3
use t::Redis;
 
4
 
 
5
test_redis {
 
6
    my ($r, $port) = @_;
 
7
 
 
8
    # make a new redis object using wrong port
 
9
    my $redis = AnyEvent::Redis->new(host => "127.0.0.1", port => Test::TCP::empty_port());
 
10
 
 
11
    # should fail
 
12
    eval { $redis->info->recv; };
 
13
 
 
14
    # fix the port and try again
 
15
    $redis->{port} = $port;
 
16
 
 
17
    my $info = $redis->info->recv;
 
18
 
 
19
    ok $info->{redis_version}, "got response after reconnect";
 
20
};
 
21
 
 
22
done_testing;