DR-Tnt

 view release on metacpan or  search on metacpan

lib/DR/Tnt/Test.pm  view on Meta::CPAN

            $tb->skip("tarantool $version is not found");
        }
        exit;
    }

}



sub free_port() {
    state $busy_ports = {};
    while( 1 ) {
        my $port = 10000 + int rand 30000;
        next if exists $busy_ports->{ $port };
        next unless IO::Socket::INET->new(
            Listen    => 5,
            LocalAddr => '127.0.0.1',
            LocalPort => $port,
            Proto     => 'tcp',
            (($^O eq 'MSWin32') ? () : (ReuseAddr => 1)),
        );
        return $busy_ports->{ $port } = $port;
    }
}

sub start_tarantool {
    my %opts = @_;
    $opts{-port} = free_port;
    DR::Tnt::Test::TntInstance->new(%opts);
}

1;



( run in 0.275 second using v1.01-cache-2.11-cpan-87723dcf8b7 )