コード例 #1
0
def test_view_change_no_propagate_primary_on_backup(replica, tconf):
    ppSeqNo = 100
    replica.isMaster = False
    replica._consensus_data.primary_name = 'SomeNode'
    # next calls emulate simple view_change procedure (replica's watermark related steps)
    emulate_catchup(replica, ppSeqNo)
    emulate_select_primaries(replica)
    assert replica.h == 0
    assert replica.H == sys.maxsize
コード例 #2
0
def test_view_change_no_propagate_primary_on_master(replica, tconf):
    ppSeqNo = 100
    replica.isMaster = True
    replica._primaryName = 'SomeNode'
    # next calls emulate simple view_change procedure (replica's watermark related steps)
    emulate_catchup(replica, ppSeqNo)
    emulate_select_primaries(replica)
    assert replica.h == ppSeqNo
    assert replica.H == ppSeqNo + tconf.LOG_SIZE
コード例 #3
0
def test_catchup_without_vc_and_no_primary_on_master(replica, tconf):
    ppSeqNo = 100
    replica.isMaster = True
    replica._primaryName = None
    # next calls emulate a catchup without vc when there is no primary selected
    # like it will be called for 'update watermark' procedure
    emulate_catchup(replica, ppSeqNo)
    # select_primaries after allLedgersCaughtUp
    emulate_select_primaries(replica)
    assert replica.h == ppSeqNo
    assert replica.H == ppSeqNo + tconf.LOG_SIZE
コード例 #4
0
def test_view_change_propagate_primary_on_backup(replica):
    ppSeqNo = 100
    replica.isMaster = False
    replica._primaryName = 'SomeNode'
    # next calls emulate view_change for propagate primary situation
    # (when the new node join to the pool)
    emulate_catchup(replica, ppSeqNo)
    emulate_select_primaries(replica)
    replica.on_propagate_primary_done()
    assert replica.h == 0
    assert replica.H == sys.maxsize
コード例 #5
0
def test_view_change_propagate_primary_on_master(replica, tconf):
    ppSeqNo = 100
    replica.isMaster = True
    replica._primaryName = 'SomeNode'
    # next calls emulate view_change for propagate primary situation
    # (when the new node join to the pool)
    emulate_catchup(replica, ppSeqNo)
    emulate_select_primaries(replica)
    replica.on_propagate_primary_done()
    assert replica.h == ppSeqNo
    assert replica.H == ppSeqNo + tconf.LOG_SIZE
コード例 #6
0
def test_catchup_without_vc_and_no_primary_on_backup(replica, tconf):
    ppSeqNo = 100
    replica.isMaster = False
    replica._consensus_data.primary_name = None
    # next calls emulate a catchup without vc when there is no primary selected
    # like it will be called for 'update watermark' procedure
    emulate_catchup(replica, ppSeqNo)
    # select_primaries after allLedgersCaughtUp
    emulate_select_primaries(replica)
    assert replica.h == 0
    assert replica.H == sys.maxsize
コード例 #7
0
def test_view_change_propagate_primary_on_backup(replica):
    ppSeqNo = 100
    replica.isMaster = False
    replica._primaryName = 'SomeNode'
    # next calls emulate view_change for propagate primary situation
    # (when the new node join to the pool)
    emulate_catchup(replica, ppSeqNo)
    emulate_select_primaries(replica)
    replica.on_propagate_primary_done()
    assert replica.h == 0
    assert replica.H == sys.maxsize
コード例 #8
0
def test_view_change_propagate_primary_on_master(replica, tconf):
    ppSeqNo = 100
    replica.isMaster = True
    replica._primaryName = 'SomeNode'
    # next calls emulate view_change for propagate primary situation
    # (when the new node join to the pool)
    emulate_catchup(replica, ppSeqNo)
    emulate_select_primaries(replica)
    replica.on_propagate_primary_done()
    assert replica.h == ppSeqNo
    assert replica.H == ppSeqNo + tconf.LOG_SIZE
コード例 #9
0
def test_view_change_no_propagate_primary_on_backup(replica, tconf):
    ppSeqNo = 100
    replica.isMaster = False
    replica._primaryName = 'SomeNode'
    # next calls emulate simple view_change procedure (replica's watermark related steps)
    emulate_catchup(replica, ppSeqNo)
    emulate_select_primaries(replica)
    if replica.viewNo > 0:
        assert replica.h == 0
        assert replica.H == tconf.LOG_SIZE
    else:
        assert replica.h == 0
        assert replica.H == sys.maxsize
コード例 #10
0
def test_view_change_no_propagate_primary_on_backup(replica, tconf):
    ppSeqNo = 100
    replica.isMaster = False
    replica._primaryName = 'SomeNode'
    # next calls emulate simple view_change procedure (replica's watermark related steps)
    emulate_catchup(replica, ppSeqNo)
    emulate_select_primaries(replica)
    if replica.viewNo > 0:
        assert replica.h == 0
        assert replica.H == tconf.LOG_SIZE
    else:
        assert replica.h == 0
        assert replica.H == sys.maxsize
コード例 #11
0
def test_catchup_without_vc_and_no_primary_on_backup(replica, tconf):
    ppSeqNo = 100
    replica.isMaster = False
    replica._primaryName = None
    # next calls emulate a catchup without vc when there is no primary selected
    # like it will be called for 'update watermark' procedure
    emulate_catchup(replica, ppSeqNo)
    # select_primaries after allLedgersCaughtUp
    emulate_select_primaries(replica)
    if replica.viewNo > 0:
        assert replica.h == 0
        assert replica.H == tconf.LOG_SIZE
    else:
        assert replica.h == 0
        assert replica.H == sys.maxsize