Remove eviction policy abstraction
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
@@ -15,7 +15,6 @@ from pyocf.types.cache import (
|
||||
Cache,
|
||||
CacheMode,
|
||||
MetadataLayout,
|
||||
EvictionPolicy,
|
||||
CleaningPolicy,
|
||||
)
|
||||
from pyocf.types.core import Core
|
||||
|
@@ -11,7 +11,7 @@ from itertools import count
|
||||
import pytest
|
||||
|
||||
from pyocf.ocf import OcfLib
|
||||
from pyocf.types.cache import Cache, CacheMode, MetadataLayout, EvictionPolicy, CleaningPolicy
|
||||
from pyocf.types.cache import Cache, CacheMode, MetadataLayout, CleaningPolicy
|
||||
from pyocf.types.core import Core
|
||||
from pyocf.types.data import Data
|
||||
from pyocf.types.io import IoDir
|
||||
@@ -38,7 +38,6 @@ def test_start_check_default(pyocf_ctx):
|
||||
assert stats["conf"]["cleaning_policy"] == CleaningPolicy.DEFAULT
|
||||
assert stats["conf"]["cache_mode"] == CacheMode.DEFAULT
|
||||
assert stats["conf"]["cache_line_size"] == CacheLineSize.DEFAULT
|
||||
assert stats["conf"]["eviction_policy"] == EvictionPolicy.DEFAULT
|
||||
|
||||
core_stats = core.get_stats()
|
||||
assert core_stats["seq_cutoff_policy"] == SeqCutOffPolicy.DEFAULT
|
||||
@@ -156,7 +155,6 @@ def test_start_params(pyocf_ctx, mode: CacheMode, cls: CacheLineSize, layout: Me
|
||||
stats = cache.get_stats()
|
||||
assert stats["conf"]["cache_mode"] == mode, "Cache mode"
|
||||
assert stats["conf"]["cache_line_size"] == cls, "Cache line size"
|
||||
assert stats["conf"]["eviction_policy"] == EvictionPolicy.DEFAULT, "Eviction policy"
|
||||
assert cache.get_name() == name, "Cache name"
|
||||
# TODO: metadata_layout, metadata_volatile, max_queue_size,
|
||||
# queue_unblock_size, pt_unaligned_io, use_submit_fast
|
||||
|
@@ -13,7 +13,7 @@ from ctypes import (
|
||||
)
|
||||
from tests.utils.random import RandomStringGenerator, RandomGenerator, DefaultRanges, Range
|
||||
|
||||
from pyocf.types.cache import CacheMode, EvictionPolicy, MetadataLayout, PromotionPolicy
|
||||
from pyocf.types.cache import CacheMode, MetadataLayout, PromotionPolicy
|
||||
from pyocf.types.shared import CacheLineSize
|
||||
|
||||
import pytest
|
||||
@@ -77,13 +77,6 @@ def not_cache_line_size_randomize(request):
|
||||
return request.param
|
||||
|
||||
|
||||
@pytest.fixture(
|
||||
params=RandomGenerator(DefaultRanges.UINT32).exclude_range(enum_range(EvictionPolicy))
|
||||
)
|
||||
def not_eviction_policy_randomize(request):
|
||||
return request.param
|
||||
|
||||
|
||||
@pytest.fixture(
|
||||
params=RandomGenerator(DefaultRanges.UINT32).exclude_range(enum_range(PromotionPolicy))
|
||||
)
|
||||
|
@@ -7,7 +7,7 @@ import logging
|
||||
|
||||
import pytest
|
||||
|
||||
from pyocf.types.cache import Cache, CacheMode, EvictionPolicy, MetadataLayout, PromotionPolicy
|
||||
from pyocf.types.cache import Cache, CacheMode, MetadataLayout, PromotionPolicy
|
||||
from pyocf.types.shared import OcfError, CacheLineSize
|
||||
from pyocf.types.volume import Volume
|
||||
from pyocf.utils import Size
|
||||
@@ -73,25 +73,6 @@ def test_fuzzy_start_name(pyocf_ctx, string_randomize, cm, cls):
|
||||
cache.stop()
|
||||
|
||||
|
||||
@pytest.mark.security
|
||||
@pytest.mark.parametrize("cm", CacheMode)
|
||||
@pytest.mark.parametrize("cls", CacheLineSize)
|
||||
def test_fuzzy_start_eviction_policy(pyocf_ctx, not_eviction_policy_randomize, cm, cls):
|
||||
"""
|
||||
Test whether it is impossible to start cache with invalid eviction policy value.
|
||||
:param pyocf_ctx: basic pyocf context fixture
|
||||
:param c_uint32_randomize: eviction policy enum value to start cache with
|
||||
:param cm: cache mode value to start cache with
|
||||
:param cls: cache line size value to start cache with
|
||||
"""
|
||||
with pytest.raises(OcfError, match="OCF_ERR_INVAL"):
|
||||
try_start_cache(
|
||||
eviction_policy=not_eviction_policy_randomize,
|
||||
cache_mode=cm,
|
||||
cache_line_size=cls
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.security
|
||||
@pytest.mark.parametrize("cm", CacheMode)
|
||||
@pytest.mark.parametrize("cls", CacheLineSize)
|
||||
|
Reference in New Issue
Block a user