diff --git a/tests/functional/pyocf/types/core.py b/tests/functional/pyocf/types/core.py index eddd56f..34b7efd 100644 --- a/tests/functional/pyocf/types/core.py +++ b/tests/functional/pyocf/types/core.py @@ -56,7 +56,7 @@ class Core: self, device: Volume, try_add: bool, - name: str = "", + name: str = "core", core_id: int = DEFAULT_ID, seq_cutoff_threshold: int = DEFAULT_SEQ_CUTOFF_THRESHOLD, ): @@ -74,7 +74,7 @@ class Core: _size=len(self.device_name) + 1, ), _core_id=self.core_id, - _name=name.encode("ascii") if name else None, + _name=cast(create_string_buffer(name.encode("ascii")), c_char_p), _volume_type=self.device.type_id, _try_add=try_add, _seq_cutoff_threshold=seq_cutoff_threshold, diff --git a/tests/functional/pyocf/types/shared.py b/tests/functional/pyocf/types/shared.py index 2467599..b317603 100644 --- a/tests/functional/pyocf/types/shared.py +++ b/tests/functional/pyocf/types/shared.py @@ -27,7 +27,9 @@ class OcfErrorCode(IntEnum): OCF_ERR_NO_FREE_RAM = auto() OCF_ERR_START_CACHE_FAIL = auto() OCF_ERR_CACHE_NOT_EXIST = auto() + OCF_ERR_CORE_NOT_EXIST = auto() OCF_ERR_CACHE_EXIST = auto() + OCF_ERR_CORE_EXIST = auto() OCF_ERR_TOO_MANY_CORES = auto() OCF_ERR_CORE_NOT_AVAIL = auto() OCF_ERR_NOT_OPEN_EXC = auto() diff --git a/tests/functional/tests/management/test_add_remove.py b/tests/functional/tests/management/test_add_remove.py index 56580af..9c35df7 100644 --- a/tests/functional/tests/management/test_add_remove.py +++ b/tests/functional/tests/management/test_add_remove.py @@ -128,7 +128,7 @@ def test_add_remove_30core(pyocf_ctx): stats = cache.get_stats() assert stats["conf"]["core_count"] == i core_device = Volume(S.from_MiB(10)) - core = Core.using_device(core_device) + core = Core.using_device(core_device, name=f"core{i}") core_devices.append(core) cache.add_core(core) @@ -158,7 +158,7 @@ def test_adding_to_random_cache(pyocf_ctx): # Create 50 core devices and add to random cache for i in range(0, core_amount): core_device = Volume(S.from_MiB(10)) - core = Core.using_device(core_device) + core = Core.using_device(core_device, name=f"core{i}") core_devices[core] = randint(0, cache_amount - 1) cache_devices[core_devices[core]].add_core(core) @@ -246,7 +246,7 @@ def test_add_remove_incrementally(pyocf_ctx, cache_mode, cls): # Create 5 core devices and add to cache for i in range(0, core_amount): core_device = Volume(S.from_MiB(10)) - core = Core.using_device(core_device) + core = Core.using_device(core_device, name=f"core{i}") core_devices.append(core) cache.add_core(core) diff --git a/tests/functional/tests/management/test_change_params.py b/tests/functional/tests/management/test_change_params.py index d607fe6..69b25e4 100644 --- a/tests/functional/tests/management/test_change_params.py +++ b/tests/functional/tests/management/test_change_params.py @@ -64,9 +64,9 @@ def test_cache_change_seq_cut_off_policy(pyocf_ctx, cm, cls): # Create 2 core devices core_device1 = Volume(S.from_MiB(10)) - core1 = Core.using_device(core_device1) + core1 = Core.using_device(core_device1, name="core1") core_device2 = Volume(S.from_MiB(10)) - core2 = Core.using_device(core_device2) + core2 = Core.using_device(core_device2, name="core2") # Add cores cache.add_core(core1) @@ -103,9 +103,9 @@ def test_core_change_seq_cut_off_policy(pyocf_ctx, cm, cls): # Create 2 core devices core_device1 = Volume(S.from_MiB(10)) - core1 = Core.using_device(core_device1) + core1 = Core.using_device(core_device1, name="core1") core_device2 = Volume(S.from_MiB(10)) - core2 = Core.using_device(core_device2) + core2 = Core.using_device(core_device2, name="core2") # Add cores cache.add_core(core1)