This is an automated email from the git hooks/post-receive script.
nsoffer pushed a commit to branch master
in repository sanlock.
commit d30a6d6282fa824beda2e7f67cb6b7a4720d954d
Author: Nir Soffer <nsoffer(a)redhat.com>
AuthorDate: Tue May 7 00:56:05 2019 +0300
tests: Test wrong sector size with 4k storage
When using 4k disk and sector=512, we expect sanlock to fail with
SanlockException(EINVAL) when writing or reading.
Two tests are marked as expected failure (xfail):
- write_resource() - not sure how sanlock can succeed with wrong sector
size - this may be a bug.
- read_resource_owners() - sanlock uses a fallback mechanism, hiding
wrong value from the user. I think we can make sanlock more strict.
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
tests/python_test.py | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/tests/python_test.py b/tests/python_test.py
index eb93762..edb6de7 100644
--- a/tests/python_test.py
+++ b/tests/python_test.py
@@ -96,6 +96,22 @@ def test_write_lockspace_4k(user_4k_path, sanlock_daemon, align):
util.check_guard(user_4k_path, align)
+def test_write_lockspace_4k_invalid_sector_size(sanlock_daemon, user_4k_path):
+ with pytest.raises(sanlock.SanlockException) as e:
+ sanlock.write_lockspace(
+ "name", user_4k_path, iotimeout=1, sector=SECTOR_SIZE_512)
+ assert e.value.errno == errno.EINVAL
+
+
+def test_read_lockspace_4k_invalid_sector_size(sanlock_daemon, user_4k_path):
+ sanlock.write_lockspace(
+ "name", user_4k_path, iotimeout=1, sector=SECTOR_SIZE_4K)
+
+ with pytest.raises(sanlock.SanlockException) as e:
+ sanlock.read_lockspace(user_4k_path, sector=SECTOR_SIZE_512)
+ assert e.value.errno == errno.EINVAL
+
+
@pytest.mark.parametrize("size,offset", [
# Smallest offset.
(MIN_RES_SIZE, 0),
@@ -178,6 +194,49 @@ def test_write_resource_4k(sanlock_daemon, user_4k_path, align):
util.check_guard(user_4k_path, align)
+(a)pytest.mark.xfail(reason="need to investigate why the call succeed")
+def test_write_resource_4k_invalid_sector_size(sanlock_daemon, user_4k_path):
+ disks = [(user_4k_path, 0)]
+
+ with pytest.raises(sanlock.SanlockException) as e:
+ sanlock.write_resource(
+ "ls_name", "res_name", disks, sector=SECTOR_SIZE_512)
+ assert e.value.errno == errno.EINVAL
+
+
+def test_read_resource_4k_invalid_sector_size(sanlock_daemon, user_4k_path):
+ disks = [(user_4k_path, 0)]
+
+ sanlock.write_resource(
+ "ls_name",
+ "res_name",
+ disks,
+ align=ALIGNMENT_1M,
+ sector=SECTOR_SIZE_4K)
+
+ with pytest.raises(sanlock.SanlockException) as e:
+ sanlock.read_resource(user_4k_path, sector=SECTOR_SIZE_512)
+ assert e.value.errno == errno.EINVAL
+
+
+(a)pytest.mark.xfail(reason="fallback hides wrong value from caller")
+def test_read_resource_owners_4k_invalid_sector_size(
+ sanlock_daemon, user_4k_path):
+ disks = [(user_4k_path, 0)]
+
+ sanlock.write_resource(
+ "ls_name",
+ "res_name",
+ disks,
+ align=ALIGNMENT_1M,
+ sector=SECTOR_SIZE_4K)
+
+ with pytest.raises(sanlock.SanlockException) as e:
+ sanlock.read_resource_owners(
+ "ls_name", "res_name", disks, sector=SECTOR_SIZE_512)
+ assert e.value.errno == errno.EINVAL
+
+
@pytest.mark.parametrize("size,offset", [
# Smallest offset.
(MIN_RES_SIZE, 0),
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.