This is an automated email from the git hooks/post-receive script.
nsoffer pushed a commit to branch master
in repository sanlock.
commit 4de75bcb5d590af75157d3ce86ae50eed426100a
Author: Nir Soffer <nsoffer(a)redhat.com>
AuthorDate: Sun May 12 04:19:28 2019 +0300
tests: Add failing test for invalid align size
sanlock_read_resource_owners() fallback mechanism hides invalid align
size specified by the caller. Add a test reproducing this issue, and
specifying the wanted behaviour.
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
tests/python_test.py | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/tests/python_test.py b/tests/python_test.py
index d70187c..49460b5 100644
--- a/tests/python_test.py
+++ b/tests/python_test.py
@@ -23,7 +23,8 @@ LARGE_FILE_SIZE = 1024**4
LOCKSPACE_SIZE = 1024**2
MIN_RES_SIZE = 1024**2
-ALIGNMENT_1M = 1024**2
+ALIGNMENT_1M = 1 * 1024**2
+ALIGNMENT_2M = 2 * 1024**2
SECTOR_SIZE_512 = 512
SECTOR_SIZE_4K = 4096
@@ -236,6 +237,29 @@ def test_read_resource_owners_4k_invalid_sector_size(
assert e.value.errno == errno.EINVAL
+(a)pytest.mark.xfail(reason="fallback hides invalid user value")
+def test_read_resource_owners_invalid_align_size(tmpdir, sanlock_daemon):
+ path = str(tmpdir.join("path"))
+ util.create_file(path, 1024**3)
+ disks = [(path, 0)]
+
+ sanlock.write_resource(
+ "ls_name",
+ "res_name",
+ disks,
+ align=ALIGNMENT_1M,
+ sector=SECTOR_SIZE_512)
+
+ with pytest.raises(sanlock.SanlockException) as e:
+ sanlock.read_resource_owners(
+ "ls_name",
+ "res_name",
+ disks,
+ align=ALIGNMENT_2M,
+ 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.
Show replies by date