From: Tony Asleson <tasleson@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - lvmdbustest: Add test removing incomplete job
Date: Mon, 19 Sep 2022 15:58:04 +0000 (GMT) [thread overview]
Message-ID: <20220919155804.A8D083858412@sourceware.org> (raw)
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f4cb78a4e1ac2cf7cc30d76e86765618071b2813
Commit: f4cb78a4e1ac2cf7cc30d76e86765618071b2813
Parent: 2ca4a2dbf3d35528f8173916aed77fd277f23f18
Author: Tony Asleson <tasleson@redhat.com>
AuthorDate: Wed Aug 17 12:14:02 2022 -0500
Committer: Tony Asleson <tasleson@redhat.com>
CommitterDate: Fri Sep 16 10:49:37 2022 -0500
lvmdbustest: Add test removing incomplete job
When you try to remove a job that is incomplete you get a dbus exception.
Test for this error condition.
---
test/dbus/lvmdbustest.py | 38 ++++++++++++++++++++++++++++++--------
1 file changed, 30 insertions(+), 8 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index d67298fe9..878300a97 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -1115,13 +1115,7 @@ class TestDbusService(unittest.TestCase):
vg_path = self._wait_for_job(vg_job)
self._validate_lookup(vg_name, vg_path)
- def _test_expired_timer(self, num_lvs):
- rc = False
-
- # In small configurations lvm is pretty snappy, so let's create a VG
- # add a number of LVs and then remove the VG and all the contained
- # LVs which appears to consistently run a little slow.
-
+ def _create_num_lvs(self, num_lvs):
vg_proxy = self._vg_create(self._all_pv_object_paths())
for i in range(0, num_lvs):
@@ -1140,8 +1134,18 @@ class TestDbusService(unittest.TestCase):
"%s/%s" % (vg_proxy.Vg.Name, lv_name), lv_path)
else:
- # We ran out of space, test will probably fail
+ # We ran out of space, test(s) may fail
break
+ return vg_proxy
+
+ def _test_expired_timer(self, num_lvs):
+ rc = False
+
+ # In small configurations lvm is pretty snappy, so let's create a VG
+ # add a number of LVs and then remove the VG and all the contained
+ # LVs which appears to consistently run a little slow.
+
+ vg_proxy = self._create_num_lvs(num_lvs)
# Make sure that we are honoring the timeout
start = time.time()
@@ -2105,6 +2109,24 @@ class TestDbusService(unittest.TestCase):
self.assertTrue(rc == 0)
self._log_file_option()
+ def test_delete_non_complete_job(self):
+ # Let's create a vg with a number of lvs and then delete it all
+ # to hopefully create a long-running job.
+ vg_proxy = self._create_num_lvs(64)
+ job_path = vg_proxy.Vg.Remove(dbus.Int32(0), EOD)
+ self.assertNotEqual(job_path, "/")
+
+ # Try to delete the job expecting an exception
+ job_proxy = ClientProxy(self.bus, job_path, interfaces=(JOB_INT,)).Job
+ with self.assertRaises(dbus.exceptions.DBusException):
+ try:
+ job_proxy.Remove()
+ except dbus.exceptions.DBusException as e:
+ # Verify we got the expected text in exception
+ self.assertTrue('Job is not complete!' in str(e))
+ raise e
+
+
class AggregateResults(object):
def __init__(self):
reply other threads:[~2022-09-19 15:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220919155804.A8D083858412@sourceware.org \
--to=tasleson@sourceware.org \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.