From 09d2843468058984eb93d5412f668ede033417a0 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Thu, 31 Mar 2022 09:40:11 +0200 Subject: [PATCH] pyocf: minor security test fixes Signed-off-by: Michal Mielewczyk --- tests/functional/tests/security/test_management_fuzzy.py | 2 +- tests/functional/tests/security/test_negative_io.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/functional/tests/security/test_management_fuzzy.py b/tests/functional/tests/security/test_management_fuzzy.py index 77dfc0f..74513b2 100644 --- a/tests/functional/tests/security/test_management_fuzzy.py +++ b/tests/functional/tests/security/test_management_fuzzy.py @@ -91,7 +91,7 @@ def test_neg_attach_cls(pyocf_ctx, cm, cls): """ # Start cache device cache_device = RamVolume(S.from_MiB(50)) - cache = Cache(owner=cache_device.owner, cache_mode=cm, cache_line_size=cls) + cache = Cache(owner=pyocf_ctx, cache_mode=cm, cache_line_size=cls) cache.start_cache() # Check whether it is possible to attach cache device with invalid cache line size diff --git a/tests/functional/tests/security/test_negative_io.py b/tests/functional/tests/security/test_negative_io.py index 0a80cf1..0d53fe6 100644 --- a/tests/functional/tests/security/test_negative_io.py +++ b/tests/functional/tests/security/test_negative_io.py @@ -128,9 +128,10 @@ def test_neg_offset_unaligned(pyocf_ctx, c_int_randomize): """ vol, queue = prepare_cache_and_core(Size.from_MiB(2)) + vol = vol.get_front_volume() data = Data(int(Size.from_KiB(1))) if c_int_randomize % 512 != 0: - with pytest.raises(Exception, match="Failed to create io!"): + with pytest.raises(Exception): vol.new_io(queue, c_int_randomize, data.size, IoDir.WRITE, 0, 0) @@ -145,7 +146,7 @@ def test_neg_size_unaligned(pyocf_ctx, c_uint16_randomize): vol, queue = prepare_cache_and_core(Size.from_MiB(2)) data = Data(int(Size.from_B(c_uint16_randomize))) if c_uint16_randomize % 512 != 0: - with pytest.raises(Exception, match="Failed to create io!"): + with pytest.raises(Exception): vol.new_io(queue, 0, data.size, IoDir.WRITE, 0, 0)