def test_get_set_cache_size_limit(flowmachine_connect_with_cache_settings_reset): """ Test that cache size can be got and set """ # Initial setting depends on the disk space of the FlowDB container so just check it is nonzero assert get_max_size_of_cache(get_db()) > 0 # Now set it to something set_max_size_of_cache(get_db(), 10) assert 10 == get_max_size_of_cache(get_db())
def flowmachine_connect_with_cache_settings_reset(flowmachine_connect): """ Fixture which ensures cache settings go back to what they were after they're manipulated. """ max_cache_size = get_max_size_of_cache(flowmachine_connect) cache_half_life = get_cache_half_life(flowmachine_connect) yield flowmachine_connect set_max_size_of_cache(flowmachine_connect, max_cache_size) set_cache_half_life(flowmachine_connect, cache_half_life)
def flowmachine_connect_with_cache_settings_reset(flowmachine_connect): """ Fixture which ensures cache settings go back to what they were after they're manipulated. """ max_cache_size = get_max_size_of_cache(get_db()) cache_half_life = get_cache_half_life(get_db()) cache_protect_period = get_cache_protected_period(get_db()) yield set_max_size_of_cache(get_db(), max_cache_size) set_cache_half_life(get_db(), cache_half_life) set_cache_protected_period(get_db(), cache_protect_period)