Fix port allocation relative to pytest-worker
Fixed port assignment issue for tests using p2p networks.
Until now, the port pool was assigned on the basis of pytest-worker-number:
# Iteration 0 ( for 5 nodes in network )
[gw0] -> 2000, 2001, 2002, 2003, 2004
[gw1] -> 3000, 3001, 3002, 3003, 3004
[gw2] -> 4000, 4001, 4002, 4003, 4004
# Iteration 1 ( for 5 nodes in network )
[gw0] -> 2000, 2001, 2002, 2003, 2004
[gw1] -> 3000, 3001, 3002, 3003, 3004
[gw2] -> 4000, 4001, 4002, 4003, 4004
...
subsequent use of the worker allocated the same ports (depending on the number of nodes in the network)
The problem occurred when the system did not immediately release the ports used after the test was completed. And the next test tried to allocate (not yet closed) ports for new network-nodes.
Fix:
- Assign additional ports from the pool
# Iteration 0 ( for 5 nodes in network )
[gw0] -> 2000, 2001, 2002, 2003, 2004
[gw1] -> 3000, 3001, 3002, 3003, 3004
[gw2] -> 4000, 4001, 4002, 4003, 4004
# Iteration 1 ( for 5 nodes in network )
[gw0] -> 2005, 2006, 2007, 2008, 2009
[gw1] -> 3005, 3006, 3007, 3008, 3009
[gw2] -> 4005, 4006, 4007, 4008, 4009
...
Edited by Michał Kudela