diff mbox series

[8/8] Migration acceptance test: reduce the possibility of port collisions

Message ID 20190607152223.9467-9-crosa@redhat.com
State New
Headers show
Series Miscellaneous acceptance test and Travis CI improvements | expand

Commit Message

Cleber Rosa June 7, 2019, 3:22 p.m. UTC
The avocado.utils.network.find_free_port() will by default attempt
to return the first port given in the range, if it seems to be
available.

Let's reduce the probability of collisions by picking a random port
by default.

As a side note, this behavior has changed in a recent Avocado version,
and the default use will then be equivalent to this proposed change.

Reference: https://avocado-framework.readthedocs.io/en/68.0/api/utils/avocado.utils.html#avocado.utils.network.find_free_port
Reference: https://github.com/avocado-framework/avocado/commit/f232e4505f7cfefc513449e0b97790b517275da7
Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
 tests/acceptance/migration.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tests/acceptance/migration.py b/tests/acceptance/migration.py
index a44c1ae58f..b2a5767348 100644
--- a/tests/acceptance/migration.py
+++ b/tests/acceptance/migration.py
@@ -25,7 +25,7 @@  class Migration(Test):
         return vm.command('query-migrate')['status'] in ('completed', 'failed')
 
     def _get_free_port(self):
-        port = network.find_free_port()
+        port = network.find_free_port(sequent=False)
         if port is None:
             self.cancel('Failed to find a free port')
         return port