Skip to content

Commit

Permalink
INDY-1918: Review fixes
Browse files Browse the repository at this point in the history
Signed-off-by: ArtObr <[email protected]>
  • Loading branch information
ArtObr committed Jan 11, 2019
1 parent fb21aa3 commit 065169f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
13 changes: 9 additions & 4 deletions indy_node/test/upgrade/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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')


Expand Down
29 changes: 13 additions & 16 deletions indy_node/test/upgrade/test_broken_connection_control_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 065169f

Please sign in to comment.