DR-TarantoolQueue
view release on metacpan or search on metacpan
t/010-tarantool-1.5/000-queue.t view on Meta::CPAN
#!/usr/bin/perl
use warnings;
use strict;
use utf8;
use open qw(:std :utf8);
use lib qw(lib ../lib);
use Test::More;
use constant PLAN => 81;
BEGIN {
system 'which tarantool_box >/dev/null 2>&1';
if ($? == 0) {
if (eval "require DR::Tarantool; 1") {
plan tests => PLAN;
} else {
plan skip_all => 'DR::Tarantool is not installed';
}
} else {
plan skip_all => 'tarantool_box not found';
}
}
use Encode qw(decode encode);
use Cwd 'cwd';
use File::Spec::Functions 'catfile';
# use feature 'state';
BEGIN {
# ÐодгоÑовка обÑекÑа ÑеÑÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ Ð´Ð»Ñ ÑабоÑÑ Ñ utf8
my $builder = Test::More->builder;
binmode $builder->output, ":utf8";
binmode $builder->failure_output, ":utf8";
binmode $builder->todo_output, ":utf8";
use_ok 'Coro';
use_ok 'DR::Tarantool', ':all';
use_ok 'DR::Tarantool::StartTest';
use_ok 'Time::HiRes', 'time';
use_ok 'Coro::AnyEvent';
}
my $t = DR::Tarantool::StartTest->run(
cfg => catfile(cwd, 'queue-lts/tarantool.cfg'),
script_dir => catfile(cwd, 'queue-lts/queue')
);
$SIG{INT} = sub {
note $t->log if $ENV{DEBUG};
$t->kill('KILL');
exit 2;
};
our $tnt;
sub tnt {
unless($tnt) {
$tnt = eval {
coro_tarantool
host => 'localhost',
port => $t->primary_port,
spaces => {
0 => {
name => 'queue',
default_type => 'STR',
fields => [
qw(uuid tube status),
{
type => 'NUM64',
name => 'event'
},
{
type => 'STR',
name => 'ipri'
},
{
type => 'STR',
name => 'pri'
},
{
type => 'NUM',
name => 'cid',
},
{
type => 'NUM64',
name => 'started'
},
{
type => 'NUM64',
name => 'ttl',
},
{
type => 'NUM64',
name => 'ttr',
},
{
type => 'NUM64',
name => 'bury'
},
{
type => 'NUM64',
name => 'taken'
},
'task',
],
indexes => {
0 => 'uuid',
1 => {
name => 'event',
fields => [qw(tube status event pri)]
}
}
}
},
};
note $t->log unless $tnt;
}
$tnt;
};
( run in 1.099 second using v1.01-cache-2.11-cpan-39bf76dae61 )