def test_node_sent_upgrade_successful_once_view_change(looper, nodeSet, nodeIds): ''' Test that each node sends NODE_UPGRADE Success event only once after each view change ''' # emulate view changes 1-4 emulate_view_change_pool_for_upgrade(nodeSet) emulate_view_change_pool_for_upgrade(nodeSet) emulate_view_change_pool_for_upgrade(nodeSet) emulate_view_change_pool_for_upgrade(nodeSet) # check that config ledger didn't changed (no new txns were sent) check_node_do_not_sent_acknowledges_upgrade(looper, nodeSet, nodeIds, allowed_actions=[COMPLETE], ledger_size=len(nodeSet), expected_version=version)
def test_node_sent_upgrade_successful_once_view_change(looper, nodeSet, nodeIds): ''' Test that each node sends NODE_UPGRADE Success event only once after each view change ''' # emulate view changes 1-4 emulate_view_change_pool_for_upgrade(nodeSet) emulate_view_change_pool_for_upgrade(nodeSet) emulate_view_change_pool_for_upgrade(nodeSet) emulate_view_change_pool_for_upgrade(nodeSet) # check that config ledger didn't changed (no new txns were sent) check_node_do_not_sent_acknowledges_upgrade(looper, nodeSet, nodeIds, allowed_actions=[COMPLETE], ledger_size=len(nodeSet), expected_version=version)
def test_scheduled_once_after_view_change(nodeSet, validUpgrade, upgradeScheduled): ''' Test that each node schedules update only once after each view change ''' # emulate view changes 1-4 emulate_view_change_pool_for_upgrade(nodeSet) emulate_view_change_pool_for_upgrade(nodeSet) emulate_view_change_pool_for_upgrade(nodeSet) emulate_view_change_pool_for_upgrade(nodeSet) # check that there are no cancel events in Upgrade log version = validUpgrade['version'] upgrade_id = nodeSet[0].upgrader.scheduledAction[2] for node in nodeSet: node_id = node.poolManager.get_nym_by_name(node.name) when = dateutil.parser.parse(validUpgrade['schedule'][node_id]) assert node.upgrader.scheduledAction == (version, when, upgrade_id) assert len(node.upgrader._actionLog) == 1 assert node.upgrader.lastActionEventInfo == (UpgradeLog.SCHEDULED, when, version, upgrade_id)
def test_scheduled_once_after_view_change(nodeSet, validUpgrade, upgradeScheduled): ''' Test that each node schedules update only once after each view change ''' # emulate view changes 1-4 emulate_view_change_pool_for_upgrade(nodeSet) emulate_view_change_pool_for_upgrade(nodeSet) emulate_view_change_pool_for_upgrade(nodeSet) emulate_view_change_pool_for_upgrade(nodeSet) # check that there are no cancel events in Upgrade log version = validUpgrade['version'] upgrade_id = nodeSet[0].upgrader.scheduledUpgrade[2] for node in nodeSet: node_id = node.poolManager.get_nym_by_name(node.name) when = dateutil.parser.parse(validUpgrade['schedule'][node_id]) assert node.upgrader.scheduledUpgrade == (version, when, upgrade_id) assert len(node.upgrader._upgradeLog) == 1 assert node.upgrader.lastUpgradeEventInfo == ( UpgradeLog.UPGRADE_SCHEDULED, when, version, upgrade_id)
def test_scheduled_once_after_view_change(nodeSet, validUpgrade, upgradeScheduled): ''' Test that each node schedules update only once after each view change ''' # emulate view changes 1-4 emulate_view_change_pool_for_upgrade(nodeSet) emulate_view_change_pool_for_upgrade(nodeSet) emulate_view_change_pool_for_upgrade(nodeSet) emulate_view_change_pool_for_upgrade(nodeSet) # check that there are no cancel events in Upgrade log version = validUpgrade['version'] upgrade_id = nodeSet[0].upgrader.scheduledAction.upgrade_id for node in nodeSet: node_id = node.poolManager.get_nym_by_name(node.name) when = dateutil.parser.parse(validUpgrade['schedule'][node_id]) ev_data = UpgradeLogData(when, version, upgrade_id, validUpgrade['package']) assert node.upgrader.scheduledAction == ev_data assert count_action_log_package(list(node.upgrader._actionLog), validUpgrade['package']) == 1 assert node.upgrader.lastActionEventInfo.ev_type == UpgradeLog.Events.scheduled assert node.upgrader.lastActionEventInfo.data == ev_data