This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master
in repository sanlock.
commit ae971829f5673ff122596466a8b5ed98fbfd2653
Author: Nir Soffer <nsoffer(a)redhat.com>
Date: Sun Feb 25 18:17:40 2018 +0200
Add resource initialization tests
Test "sanlock client init -r", "sanlock direct init -r" commands,
and
sanlock.write_resource() python bindings.
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
tests/daemon_test.py | 17 +++++++++++++++++
tests/direct_test.py | 17 +++++++++++++++++
tests/python_test.py | 16 ++++++++++++++++
3 files changed, 50 insertions(+)
diff --git a/tests/daemon_test.py b/tests/daemon_test.py
index ea06f31..dc5aadd 100644
--- a/tests/daemon_test.py
+++ b/tests/daemon_test.py
@@ -57,3 +57,20 @@ def test_init_lockspace(tmpdir, sanlock_daemon):
# TODO: check more stuff here...
util.check_guard(str(path), size)
+
+
+def test_init_resource(tmpdir, sanlock_daemon):
+ path = tmpdir.join("resources")
+ size = 1024**2
+ util.create_file(str(path), size)
+
+ resource = "ls_name:res_name:%s:0" % path
+ util.sanlock("client", "init", "-r", resource)
+
+ with io.open(str(path), "rb") as f:
+ magic, = struct.unpack("< I", f.read(4))
+ assert magic == constants.PAXOS_DISK_MAGIC
+
+ # TODO: check more stuff here...
+
+ util.check_guard(str(path), size)
diff --git a/tests/direct_test.py b/tests/direct_test.py
index e293dc2..d32ef52 100644
--- a/tests/direct_test.py
+++ b/tests/direct_test.py
@@ -24,3 +24,20 @@ def test_init_lockspace(tmpdir):
# TODO: check more stuff here...
util.check_guard(str(path), size)
+
+
+def test_init_resource(tmpdir, sanlock_daemon):
+ path = tmpdir.join("resources")
+ size = 1024**2
+ util.create_file(str(path), size)
+
+ resource = "ls_name:res_name:%s:0" % path
+ util.sanlock("direct", "init", "-r", resource)
+
+ with io.open(str(path), "rb") as f:
+ magic, = struct.unpack("< I", f.read(4))
+ assert magic == constants.PAXOS_DISK_MAGIC
+
+ # TODO: check more stuff here...
+
+ util.check_guard(str(path), size)
diff --git a/tests/python_test.py b/tests/python_test.py
index 495b809..ea12b85 100644
--- a/tests/python_test.py
+++ b/tests/python_test.py
@@ -25,3 +25,19 @@ def test_write_lockspace(tmpdir, sanlock_daemon):
# TODO: check more stuff here...
util.check_guard(str(path), size)
+
+
+def test_init_resource(tmpdir, sanlock_daemon):
+ path = tmpdir.join("resources")
+ size = 1024**2
+ util.create_file(str(path), size)
+
+ sanlock.write_resource("ls_name", "res_name", [(str(path), 0)])
+
+ with io.open(str(path), "rb") as f:
+ magic, = struct.unpack("< I", f.read(4))
+ assert magic == constants.PAXOS_DISK_MAGIC
+
+ # TODO: check more stuff here...
+
+ util.check_guard(str(path), size)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.