Ejemplo n.º 1
0
def test_get_new_dead_heartbeats(store, random_heartbeats):
    # test the 'between' logic for checking newly-dead accounts
    make_dead_heartbeat(store, random_heartbeats, 7, -1, 100)
    make_dead_heartbeat(store, random_heartbeats, 2, -2, 1000)

    # All thresholds are in 'seconds before now'
    new_dead_threshold = ALIVE_EXPIRY + 500
    new_dead = list_dead_accounts(dead_since=new_dead_threshold)
    assert new_dead == ["7"]

    old_dead = list_dead_accounts(dead_threshold=new_dead_threshold, dead_since=new_dead_threshold + 1000)
    assert old_dead == ["2"]

    # The future is impossible
    wrong_threshold = ALIVE_EXPIRY / 2
    impossible_dead = list_dead_accounts(dead_since=wrong_threshold)
    assert impossible_dead == []
Ejemplo n.º 2
0
def test_get_new_dead_heartbeats(store, random_heartbeats):
    # test the 'between' logic for checking newly-dead accounts
    make_dead_heartbeat(store, random_heartbeats, 7, -1, 100)
    make_dead_heartbeat(store, random_heartbeats, 2, -2, 1000)

    # All thresholds are in 'seconds before now'
    new_dead_threshold = ALIVE_EXPIRY + 500
    new_dead = list_dead_accounts(dead_since=new_dead_threshold)
    assert new_dead == ['7']

    old_dead = list_dead_accounts(dead_threshold=new_dead_threshold,
                                  dead_since=new_dead_threshold + 1000)
    assert old_dead == ['2']

    # The future is impossible
    wrong_threshold = ALIVE_EXPIRY / 2
    impossible_dead = list_dead_accounts(dead_since=wrong_threshold)
    assert impossible_dead == []
Ejemplo n.º 3
0
def test_get_alive_dead_heartbeats(store, random_heartbeats):
    # kill an account by publishing one expired folder
    make_dead_heartbeat(store, random_heartbeats, 3, 1, 100)

    alive = list_alive_accounts()
    assert '3' not in alive

    dead = list_dead_accounts()
    assert dead == ['3']
Ejemplo n.º 4
0
def test_get_alive_dead_heartbeats(store, random_heartbeats):
    # kill an account by publishing one expired folder
    make_dead_heartbeat(store, random_heartbeats, 3, 1, 100)

    alive = list_alive_accounts()
    assert "3" not in alive

    dead = list_dead_accounts()
    assert dead == ["3"]