Exemplo n.º 1
0
def test_locator_cache_is_full(block_processor):
    # Empty cache
    locator_cache = LocatorCache(config.get("LOCATOR_CACHE_SIZE"))

    for _ in range(locator_cache.cache_size):
        locator_cache.blocks[uuid4().hex] = 0
        assert not locator_cache.is_full()

    locator_cache.blocks[uuid4().hex] = 0
    assert locator_cache.is_full()
Exemplo n.º 2
0
def test_locator_cache_is_full():
    # is_full should return whether the cache is full or not.
    # Create an empty cache
    locator_cache = LocatorCache(config.get("LOCATOR_CACHE_SIZE"))

    # Fill it one by one and check it is not full
    for _ in range(locator_cache.cache_size):
        locator_cache.blocks[uuid4().hex] = 0
        assert not locator_cache.is_full()

    # Add one more block and check again, it should be full now
    locator_cache.blocks[uuid4().hex] = 0
    assert locator_cache.is_full()