Increase timeout for wait_for_port
Following up Squish advise: In the wait_for_port.py, you are using socket.create_connection() where the timeout is set to 1. Could you increase the timeout here and also put a check before to make sure that port is not in the use anymore, before proceeding to launch the AUT.
This commit is contained in:
parent
7b188afd3e
commit
e2f2a34a8b
|
@ -4,12 +4,14 @@ import logging
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
def wait_for_port(host: str, port: int, timeout: int = 1, retries: int = 0):
|
|
||||||
for i in range(retries+1):
|
def wait_for_port(host: str, port: int, timeout: int = 3, retries: int = 0):
|
||||||
|
for i in range(retries + 1):
|
||||||
try:
|
try:
|
||||||
LOG.debug('Checking TCP port: %s:%d', host, port)
|
LOG.debug('Checking TCP port: %s:%d', host, port)
|
||||||
with socket.create_connection((host, port), timeout=timeout):
|
with socket.create_connection((host, port), timeout=timeout):
|
||||||
return
|
if socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex((host, port)) == 0:
|
||||||
|
return
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
LOG.debug('Connection error: %s', err)
|
LOG.debug('Connection error: %s', err)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
|
@ -12,6 +12,8 @@ from constants.messaging import Messaging
|
||||||
from gui.main_window import MainWindow
|
from gui.main_window import MainWindow
|
||||||
|
|
||||||
pytestmark = marks
|
pytestmark = marks
|
||||||
|
|
||||||
|
|
||||||
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704611', 'Reply to identity request')
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704611', 'Reply to identity request')
|
||||||
@pytest.mark.case(704611)
|
@pytest.mark.case(704611)
|
||||||
@pytest.mark.parametrize('user_data_one, user_data_two', [
|
@pytest.mark.parametrize('user_data_one, user_data_two', [
|
||||||
|
|
Loading…
Reference in New Issue