From 065169f338db19bd85ff1b25058b2edf7e9d9a41 Mon Sep 17 00:00:00 2001 From: ArtObr Date: Fri, 11 Jan 2019 16:52:35 +0300 Subject: [PATCH] INDY-1918: Review fixes Signed-off-by: ArtObr --- indy_node/test/upgrade/conftest.py | 13 ++++++--- .../test_broken_connection_control_tool.py | 29 +++++++++---------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/indy_node/test/upgrade/conftest.py b/indy_node/test/upgrade/conftest.py index a0f9c903d..668c57007 100644 --- a/indy_node/test/upgrade/conftest.py +++ b/indy_node/test/upgrade/conftest.py @@ -61,7 +61,12 @@ def mock_get_info_from_package_manager(package): @pytest.fixture(scope='function', params=[(EXT_PKT_NAME, EXT_PKT_VERSION), (APP_NAME, None)]) -def validUpgrade(nodeIds, tconf, monkeypatch, request): +def pckg(request): + return request.param + + +@pytest.fixture(scope='function') +def validUpgrade(nodeIds, tconf, monkeypatch, pckg): schedule = {} unow = datetime.utcnow().replace(tzinfo=dateutil.tz.tzutc()) startAt = unow + timedelta(seconds=100) @@ -70,10 +75,10 @@ def validUpgrade(nodeIds, tconf, monkeypatch, request): schedule[i] = datetime.isoformat(startAt) startAt = startAt + timedelta(seconds=acceptableDiff + 3) - patch_packet_mgr_output(monkeypatch, request.param[0], request.param[1]) + patch_packet_mgr_output(monkeypatch, pckg[0], pckg[1]) - return dict(name='upgrade-{}'.format(randomText(3)), version=bumpedVersion(request.param[1]), - action=START, schedule=schedule, timeout=1, package=request.param[0], + return dict(name='upgrade-{}'.format(randomText(3)), version=bumpedVersion(pckg[1]), + action=START, schedule=schedule, timeout=1, package=pckg[0], sha256='db34a72a90d026dae49c3b3f0436c8d3963476c77468ad955845a1ccf7b03f55') diff --git a/indy_node/test/upgrade/test_broken_connection_control_tool.py b/indy_node/test/upgrade/test_broken_connection_control_tool.py index 0b5968e60..e33bceff9 100644 --- a/indy_node/test/upgrade/test_broken_connection_control_tool.py +++ b/indy_node/test/upgrade/test_broken_connection_control_tool.py @@ -17,6 +17,11 @@ logger = getlogger() +@pytest.fixture(scope='function') +def pckg(): + return (EXT_PKT_NAME, EXT_PKT_VERSION) + + @pytest.fixture(scope="module") def tconf(tconf): old_delta = tconf.MinSepBetweenNodeUpgrades @@ -25,22 +30,6 @@ def tconf(tconf): tconf.MinSepBetweenNodeUpgrades = old_delta -@pytest.fixture(scope='function') -def validUpgrade(nodeIds, tconf, monkeypatch): - schedule = {} - unow = datetime.utcnow().replace(tzinfo=dateutil.tz.tzutc()) - startAt = unow + timedelta(seconds=delta) - for i in nodeIds: - schedule[i] = datetime.isoformat(startAt) - startAt = startAt + timedelta(seconds=delta) - - patch_packet_mgr_output(monkeypatch, EXT_PKT_NAME, EXT_PKT_VERSION) - - return dict(name='upgrade-{}'.format(randomText(3)), version=bumpedVersion(EXT_PKT_VERSION), - action=START, schedule=schedule, timeout=1, package=EXT_PKT_NAME, - sha256='db34a72a90d026dae49c3b3f0436c8d3963476c77468ad955845a1ccf7b03f55') - - @pytest.fixture(scope='function') def skip_functions(): # Do this to prevent exceptions because of node_control_tool absence @@ -55,6 +44,14 @@ def skip_functions(): def test_node_doesnt_retry_upgrade(looper, nodeSet, validUpgrade, nodeIds, sdk_pool_handle, sdk_wallet_trustee, tconf, skip_functions): + schedule = {} + unow = datetime.utcnow().replace(tzinfo=dateutil.tz.tzutc()) + startAt = unow + timedelta(seconds=delta) + for i in nodeIds: + schedule[i] = datetime.isoformat(startAt) + startAt = startAt + timedelta(seconds=delta) + validUpgrade['schedule'] = schedule + # Emulating connection problems for node in nodeSet: node.upgrader.retry_limit = 0