Пример #1
0
def testNonTrustyCannotCancelUpgrade(looper, validUpgradeSent, steward,
                                     validUpgrade):
    stClient, stWallet = steward
    validUpgradeCopy = deepcopy(validUpgrade)
    validUpgradeCopy[ACTION] = CANCEL
    _, req = sendUpgrade(stClient, stWallet, validUpgradeCopy)
    looper.run(eventually(checkRejects, stClient, req.reqId, 'cannot do'))
Пример #2
0
def testOnlyTrusteeCanSendPoolUpgradeForceTrue(
        looper, steward, validUpgradeExpForceTrue):
    stClient, stWallet = steward
    _, req = sendUpgrade(stClient, stWallet, validUpgradeExpForceTrue)
    timeout = plenumWaits.expectedReqNAckQuorumTime()
    looper.run(eventually(checkNacks, stClient, req.reqId,
                          'cannot do', retryWait=1, timeout=timeout))
def testOnlyTrusteeCanSendPoolUpgradeForceTrue(
        looper, steward, validUpgradeExpForceTrue):
    stClient, stWallet = steward
    _, req = sendUpgrade(stClient, stWallet, validUpgradeExpForceTrue)
    timeout = plenumWaits.expectedReqNAckQuorumTime()
    looper.run(eventually(checkNacks, stClient, req.reqId,
                          'cannot do', retryWait=1, timeout=timeout))
def testNodeRejectsPoolUpgrade(looper, nodeSet, tdir, trustee,
                               trusteeWallet, invalidUpgrade):
    _, req = sendUpgrade(trustee, trusteeWallet, invalidUpgrade)
    timeout = plenumWaits.expectedReqNAckQuorumTime()
    looper.run(eventually(checkNacks, trustee, req.reqId,
                          'since time span between upgrades', retryWait=1,
                          timeout=timeout))
Пример #5
0
def testNodeRejectsPoolUpgrade(looper, nodeSet, tdir, trustee,
                               trusteeWallet, invalidUpgrade):
    _, req = sendUpgrade(trustee, trusteeWallet, invalidUpgrade)
    timeout = plenumWaits.expectedReqNAckQuorumTime()
    looper.run(eventually(checkNacks, trustee, req.reqId,
                          'since time span between upgrades', retryWait=1,
                          timeout=timeout))
def testNonTrustyCannotCancelUpgrade(looper, validUpgradeSent,
                                     steward, validUpgrade):
    stClient, stWallet = steward
    validUpgradeCopy = deepcopy(validUpgrade)
    validUpgradeCopy[ACTION] = CANCEL
    _, req = sendUpgrade(stClient, stWallet, validUpgradeCopy)
    looper.run(eventually(checkRejects, stClient, req.reqId,
                          'cannot do'))
def testOnlyTrusteeCanSendPoolUpgrade(looper, steward, validUpgrade):
    # A steward sending POOL_UPGRADE but txn fails
    stClient, stWallet = steward
    validUpgrade = deepcopy(validUpgrade)
    validUpgrade[NAME] = 'upgrade-20'
    validUpgrade[VERSION] = bumpedVersion()
    _, req = sendUpgrade(stClient, stWallet, validUpgrade)
    timeout = plenumWaits.expectedReqNAckQuorumTime()
    looper.run(eventually(checkRejects, stClient, req.reqId,
                          'cannot do', retryWait=1, timeout=timeout))
Пример #8
0
def testOnlyTrusteeCanSendPoolUpgrade(looper, steward, validUpgrade):
    # A steward sending POOL_UPGRADE but txn fails
    stClient, stWallet = steward
    validUpgrade = deepcopy(validUpgrade)
    validUpgrade[NAME] = 'upgrade-20'
    validUpgrade[VERSION] = bumpedVersion()
    _, req = sendUpgrade(stClient, stWallet, validUpgrade)
    timeout = plenumWaits.expectedReqNAckQuorumTime()
    looper.run(eventually(checkRejects, stClient, req.reqId,
                          'cannot do', retryWait=1, timeout=timeout))
def test_forced_upgrade_no_consensus_on_single_node(
        validUpgradeExpForceTrue, looper, nodeSet, trustee, trusteeWallet):
    nup = validUpgradeExpForceTrue.copy()
    nup.update({VERSION: bumpVersion(validUpgradeExpForceTrue[VERSION])})
    for node in nodeSet:
        if node.name != "Alpha":
            node.cleanupOnStopping = False
            looper.removeProdable(node)
            node.stop()
        else:
            node.upgrader.scheduledUpgrade = None
    sendUpgrade(trustee, trusteeWallet, nup)

    def testsched():
        for node in nodeSet:
            if node.name == "Alpha":
                assert node.upgrader.scheduledUpgrade
                assert node.upgrader.scheduledUpgrade[0] == nup[VERSION]

    looper.run(eventually(testsched, retryWait=1,
                          timeout=waits.expectedUpgradeScheduled()))
def test_accept_then_reject_upgrade(
        looper, trustee, trusteeWallet, validUpgradeSent, validUpgrade):
    upgrade_name = validUpgrade[NAME]
    error_msg = "InvalidClientRequest(\"Upgrade '{}' is already scheduled\"".\
        format(upgrade_name)

    validUpgrade2 = deepcopy(validUpgrade)

    _, req = sendUpgrade(trustee, trusteeWallet, validUpgrade2)
    timeout = plenumWaits.expectedReqNAckQuorumTime()

    looper.run(eventually(checkRejects, trustee, req.reqId,
                          error_msg, retryWait=1, timeout=timeout))
Пример #11
0
def test_accept_then_reject_upgrade(
        looper, trustee, trusteeWallet, validUpgradeSent, validUpgrade):
    upgrade_name = validUpgrade[NAME]
    error_msg = "InvalidClientRequest(\"Upgrade '{}' is already scheduled\"".format(
        upgrade_name)

    validUpgrade2 = deepcopy(validUpgrade)

    _, req = sendUpgrade(trustee, trusteeWallet, validUpgrade2)
    timeout = plenumWaits.expectedReqNAckQuorumTime()

    looper.run(eventually(checkRejects, trustee, req.reqId,
                          error_msg, retryWait=1, timeout=timeout))
Пример #12
0
def testForcedUpgradeNoConsensusOnSingleNode(validUpgradeExpForceTrue, looper,
                                             nodeSet, trustee, trusteeWallet):
    nup = validUpgradeExpForceTrue.copy()
    nup.update({VERSION: bumpVersion(validUpgradeExpForceTrue[VERSION])})
    for node in nodeSet:
        if node.name != "Alpha":
            node.cleanupOnStopping = False
            looper.removeProdable(node)
            node.stop()
        else:
            node.upgrader.scheduledUpgrade = None
    sendUpgrade(trustee, trusteeWallet, nup)

    def testsched():
        for node in nodeSet:
            if node.name == "Alpha":
                assert node.upgrader.scheduledUpgrade
                assert node.upgrader.scheduledUpgrade[0] == nup[VERSION]

    looper.run(
        eventually(testsched,
                   retryWait=1,
                   timeout=waits.expectedUpgradeScheduled()))
def testTrustyCancelsUpgrade(validUpgradeSent, looper, nodeSet, trustee,
                             trusteeWallet, validUpgrade):
    validUpgradeCopy = deepcopy(validUpgrade)
    validUpgradeCopy[ACTION] = CANCEL
    validUpgradeCopy[JUSTIFICATION] = '"not gonna give you one"'

    validUpgradeCopy.pop(SCHEDULE, None)
    upgrade, req = sendUpgrade(trustee, trusteeWallet, validUpgradeCopy)

    def check():
        assert trusteeWallet.getPoolUpgrade(upgrade.key).seqNo

    timeout = plenumWaits.expectedTransactionExecutionTime(len(nodeSet))
    looper.run(eventually(check, retryWait=1, timeout=timeout))

    looper.run(eventually(checkNoUpgradeScheduled, nodeSet, retryWait=1,
                          timeout=waits.expectedNoUpgradeScheduled()))
Пример #14
0
def testTrustyCancelsUpgrade(validUpgradeSent, looper, nodeSet, trustee,
                             trusteeWallet, validUpgrade):
    validUpgradeCopy = deepcopy(validUpgrade)
    validUpgradeCopy[ACTION] = CANCEL
    validUpgradeCopy[JUSTIFICATION] = '"not gonna give you one"'

    validUpgradeCopy.pop(SCHEDULE, None)
    upgrade, req = sendUpgrade(trustee, trusteeWallet, validUpgradeCopy)

    def check():
        assert trusteeWallet.getPoolUpgrade(upgrade.key).seqNo

    timeout = plenumWaits.expectedTransactionExecutionTime(len(nodeSet))
    looper.run(eventually(check, retryWait=1, timeout=timeout))

    looper.run(
        eventually(checkNoUpgradeScheduled,
                   nodeSet,
                   retryWait=1,
                   timeout=waits.expectedNoUpgradeScheduled()))