https://github.com/igorcoding/test-tarantool16
Tarantool 1.6 runner for tests
https://github.com/igorcoding/test-tarantool16
Last synced: 2 months ago
JSON representation
Tarantool 1.6 runner for tests
- Host: GitHub
- URL: https://github.com/igorcoding/test-tarantool16
- Owner: igorcoding
- Created: 2015-06-05T10:10:25.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-12-01T16:26:06.000Z (over 8 years ago)
- Last Synced: 2024-04-20T00:11:03.670Z (about 1 year ago)
- Language: Perl
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: Changes
Awesome Lists containing this project
README
NAME
Test::Tarantool16 - The Swiss army knife for tests of Tarantool 1.6
related Perl and lua code.VERSION
Version 0.033SYNOPSIS
use Test::Tarantool16;
use AnyEvent;# Clear data and exit on Ctrl+C.
my $w = AnyEvent->signal (signal => "INT", cb => sub { exit 0 });my @shards = map {
my $n = $_;
Test::Tarantool16->new(
host => '127.17.3.0',
initlua => do {
open my $f, '<', 'init.lua';
local $/ = undef;
<$f> or "";
},
on_die => sub { warn "Shard #$n unexpectedly terminated\n"; exit; },
);
} 1..4;my @cluster = map { [ $_->{host}, $_->{p_port} ] } @shards;
{
my $cv = AE::cv();
$cv->begin for (@shards);
$_->start($cv) for (@shards);
$cv->recv;
}{
$_->sync_start() for (@shards);
}{
my ($status, $reason) = $shards[0]->sync_ro();
die $reason unless $status;
print (($shards[0]->sync_admin_cmd("show info"))[1]);
}# Some test case here
$shards[1]->pause();
# Some test case here
$shards[1]->resume();
{
my ($status, $reason) = $shards[0]->sync_rw();
die $reason unless $status;
print (($shards[0]->sync_admin_cmd("show info"))[1]);
}# stop tarantools and clear work directoies
@shards = ();SUBROUTINES/METHODS
new option => value,...
Create new Test::Tarantool16 instance. Every call of new method increase
counter, below called as *tarantool number* or *tn*.root => $path
Tarantool 1.6 work directory. Default is
*./tnt_<10_random_lowercase_letters>*arena => $size
The maximal size of tarantool arena in Gb. Default is *0.1*cleanup => $bool
Remove tarantool work directory after garbage collection. Default is
*1*initlua => $content
Content of init.lua file. Be default an empty file created.host => $address
Address bind to. Default: *127.0.0.1*port => $port
Primary port number. Default is *3301+*4*admin_port => $admin_port
Admin port number. Default is "$port * 10"title => $title
Part of process name (custom_proc_title) Default is *"yat $mode
The WAL write mode. See the desctiption of wal_mode tarantool
variable. Default is *none*. Look more about wal_mode in tarantool
documentation.log_level => $number
Tarantool log level. Default is *5*snapshot => $path
Path to some snapshot. If given the symbolic link to it will been
created in tarantool work directory.replication_source => $string
If given the server is considered to be a Tarantool replica.logger => $sub
An subroutine called at every time, when tarantool write some thing
in a log. The writed text passed as the first argument. Default is
warn.on_die => $sub
An subroutine called on a unexpected tarantool termination.tarantool_cmd => $tarantool_cmd
Command that should start tarantool instance. Parameterized with
%{args}. All necessary arguments will be substitued into %{args}start option => $value, $cb->($status, $reason)
Run tarantool instance.timeout => $timeout
If not After $timeout seconds tarantool will been killed by the KILL
signal if not started.stop option => $value, $cb->($status, $reason)
stop tarantool instancetimeout => $timeout
After $timeout seconds tarantool will been kelled by the KILL signalpause
Send STOP signal to instanceresume
Send CONT signal to instanceadmin_cmd $cmd, $cb->($status, $response_or_reason)
Exec a command via the admin port.times
Return values of utime and stime from /proc/[pid]/stat, converted to
secondssync_start sync_stop sync_admin_cmd
Aliases for start, stop, admin_cmd respectively, arguments a similar,
but cb not passed.AUTHOR
Anton Reznikov, "" igorcoding,
""BUGS
Please report any bugs or feature requests in
SUPPORT
You can find documentation for this module with the perldoc command.perldoc Test::Tarantool16
ACKNOWLEDGEMENTS
Mons Anderson - The original idea of the module.LICENSE AND COPYRIGHT
Copyright 2015 igorcoding.This program is released under the following license: GPL