Пятница, 6 апреля 2018, 11:49 +03:00 от Konstantin Osipov <kostja@tarantool.org>:

* Konstantin Belyavskiy <k.belyavskiy@tarantool.org> [18/04/06 11:40]:
> +socket = require('socket')
> +---
> +...
> +s = socket.tcp_server('localhost', 3371, function() end)

Is it possible to avoid using a specific port? The port may be
already in use for a thousand of reasons, and this will break the test.
Done, the aim here was to make one port busy to make sure, that no other tarantool instance use it.
But here was an error due to this port was socket based.
Update this code and transfer found port to replica script as a third parameter.
> +++ b/test/replication/replica_params.lua
> @@ -0,0 +1,21 @@
> +#!/usr/bin/env tarantool
> +
> +local quorum = tonumber(arg[1])
> +local n_replics = tonumber(arg[2])
> +listen = os.getenv("LISTEN")
> +-- Test different replicaset configurations:
> +-- First, when the only address in the replicaset is itself.
> +repl = {listen}
> +-- To test situation with second master unavailable, add
> +-- second address (should be empty).
> +if n_replics == 2 then repl = { listen, '127.0.0.1:3371' } end
> +
> +box.cfg({
> + listen = listen,
> + replication = repl,
> + memtx_memory = 107374182,

Why? What's magical about this number? Could you use 100 * 1024 *
1024 instead? Then it's clear the test is not using too much
memory and the exact amount is also clearly visible.
OK, it was "copy exactly" principle, just reuse same value.
> + replication_connect_quorum = quorum,
> + replication_connect_timeout = 0.1,
> +})
> +
> +require('console').listen(os.getenv('ADMIN'))

Thanks,


--
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov



Best regards,
Konstantin Belyavskiy
k.belyavskiy@tarantool.org