<commit_before>from plenum.common.eventually import eventually
from plenum.common.log import getlogger
from plenum.common.port_dispenser import genHa
from plenum.test.node_catchup.helper import checkNodeLedgersForEquality, \
    ensureClientConnectedToNodesAndPoolLedgerSame
from plenum.test.pool_transactions.helper import changeNodeHa, \
    buildPoolClientAndWallet
from plenum.test.test_node import TestNode, checkNodesConnected

logger = getlogger()


whitelist = ['found legacy entry', "doesn't match", "reconciling nodeReg",
             "missing", "conflicts", "matches", "nodeReg", "conflicting address"]


def testChangeHaPersistsPostNodesRestart(looper, txnPoolNodeSet,
                                         tdirWithPoolTxns, tconf, steward1,
                                         stewardWallet, nodeThetaAdded,
                                         poolTxnClientData):
    newSteward, newStewardWallet, newNode = nodeThetaAdded
    nodeNewHa, clientNewHa = genHa(2)
    logger.debug("{} changing HAs to {} {}".format(newNode, nodeNewHa,
                                                   clientNewHa))

    # Making the change HA txn an confirming its succeeded
    changeNodeHa(looper, newSteward, newStewardWallet, newNode,
                 nodeHa=nodeNewHa, clientHa=clientNewHa)

    # Stopping existing nodes
    for node in txnPoolNodeSet:
        node.stop()
        looper.removeProdable(node)

    # Starting nodes again by creating `Node` objects since that simulates
    # what happens when starting the node with script
    restartedNodes = []<commit_msg>adding whitelist message<commit_after>from plenum.common.eventually import eventually
from plenum.common.log import getlogger
from plenum.common.port_dispenser import genHa
from plenum.test.node_catchup.helper import checkNodeLedgersForEquality, \
    ensureClientConnectedToNodesAndPoolLedgerSame
from plenum.test.pool_transactions.helper import changeNodeHa, \
    buildPoolClientAndWallet
from plenum.test.test_node import TestNode, checkNodesConnected

logger = getlogger()


whitelist = ['found legacy entry', "doesn't match", "reconciling nodeReg",
             "missing", "conflicts", "matches", "nodeReg",
             "conflicting address", "got error while verifying message"]


def testChangeHaPersistsPostNodesRestart(looper, txnPoolNodeSet,
                                         tdirWithPoolTxns, tconf, steward1,
                                         stewardWallet, nodeThetaAdded,
                                         poolTxnClientData):
    newSteward, newStewardWallet, newNode = nodeThetaAdded
    nodeNewHa, clientNewHa = genHa(2)
    logger.debug("{} changing HAs to {} {}".format(newNode, nodeNewHa,
                                                   clientNewHa))

    # Making the change HA txn an confirming its succeeded
    changeNodeHa(looper, newSteward, newStewardWallet, newNode,
                 nodeHa=nodeNewHa, clientHa=clientNewHa)

    # Stopping existing nodes
    for node in txnPoolNodeSet:
        node.stop()
        looper.removeProdable(node)

    # Starting nodes again by creating `Node` objects since that simulates
    # what happens when starting the node with script
    restartedNodes = []
{'fraction_non_alphanumeric': 0.0688909484090207, 'fraction_numerical': 0.001235712079085573, 'mean_word_length': 2.7871345029239767, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6442395', 'n_tokens_mistral': 857, 'n_tokens_neox': 842, 'n_words': 225}