DBIx-RetryConnect

 view release on metacpan or  search on metacpan

t/10-basic-ok.t  view on Meta::CPAN

#!/usr/bin/env perl

use Test::Most;

use DBIx::RetryConnect qw(NullP);

sub is_not_delayed(&) {
    my $start_time = time;
    shift->();
    cmp_ok time - $start_time, '<=', 5, 'executed reasonably quickly';
}

is_not_delayed {
    ok(DBI->connect('dbi:NullP:'), 'connect worked');
};


t/11-configured-ok.t  view on Meta::CPAN

    is $dsn, 'driverdsn', 'got right driver dsn';
    is $user, 'u', 'got username';
    is $password, 'p', 'got password';
    is ref $attrib, 'HASH', 'got attribs';

    is $drh->err, 42, 'err is set';

    return {};
};

sub duration_of(&) {
    my $start_time = time;
    shift->();
    return time - $start_time;
}


cmp_ok duration_of {
    ok(DBI->connect('dbi:NoConnect:driverdsn', 'u', 'p', { no_connect => { countdown => 0 }}), 'connect worked');
}, '<', 2, 'is fast with no connection failures';
is $config_coderef_called, undef, 'config code ref should not be called if no failure';



( run in 1.090 second using v1.01-cache-2.11-cpan-49f99fa48dc )