DR-Tnt

 view release on metacpan or  search on metacpan

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

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
            $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.304 second using v1.01-cache-2.11-cpan-8d75d55dd25 )