This is an automated email from the git hooks/post-receive script.
nsoffer pushed a commit to branch master in repository sanlock.
commit 7874592fcd604e594d84e070496eedb0d04ed1de Author: Nir Soffer nsoffer@redhat.com AuthorDate: Sun Jun 16 22:30:56 2019 +0300
python: Add missing arg parsing tests
Add argument parsing tests for sanlock.acquire() and sanlock.request().
Signed-off-by: Nir Soffer nsoffer@redhat.com --- tests/python_test.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
diff --git a/tests/python_test.py b/tests/python_test.py index 0f70a6a..86e60b1 100644 --- a/tests/python_test.py +++ b/tests/python_test.py @@ -11,6 +11,7 @@ from __future__ import absolute_import
import errno import io +import os import time
from contextlib import contextmanager @@ -697,3 +698,29 @@ def test_read_resource_parse_args(no_sanlock_daemon, filename, encoding): path = util.generate_path("/tmp/", filename, encoding) with raises_sanlock_errno(): sanlock.read_resource(path) + + +@pytest.mark.parametrize("name", LOCKSPACE_OR_RESOURCE_NAMES) +@pytest.mark.parametrize("filename,encoding", FILE_NAMES) +def test_request_parse_args(no_sanlock_daemon, name, filename, encoding): + path = util.generate_path("/tmp/", filename, encoding) + disks = [(path, 0)] + + with raises_sanlock_errno(): + sanlock.request(b"ls_name", name, disks) + + with raises_sanlock_errno(): + sanlock.request(name, b"res_name", disks) + + +@pytest.mark.parametrize("name", LOCKSPACE_OR_RESOURCE_NAMES) +@pytest.mark.parametrize("filename,encoding", FILE_NAMES) +def test_acquire_parse_args(no_sanlock_daemon, name, filename, encoding): + path = util.generate_path("/tmp/", filename, encoding) + disks = [(path, 0)] + + with raises_sanlock_errno(): + sanlock.acquire(b"ls_name", name, disks, pid=os.getpid()) + + with raises_sanlock_errno(): + sanlock.acquire(name, b"res_name", disks, pid=os.getpid())
sanlock-devel@lists.fedorahosted.org