All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Asleson <tasleson@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - lvmdbustest: Remove force exception in _wait_for_job
Date: Mon, 19 Sep 2022 15:57:51 +0000 (GMT)	[thread overview]
Message-ID: <20220919155751.156DE3858C54@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ea45ba753eaa168429b9747500e6f31f2856890f
Commit:        ea45ba753eaa168429b9747500e6f31f2856890f
Parent:        3fdf4493481ff8baae2ac5416dce6d05b69e6b28
Author:        Tony Asleson <tasleson@redhat.com>
AuthorDate:    Tue Aug 9 17:36:54 2022 -0500
Committer:     Tony Asleson <tasleson@redhat.com>
CommitterDate: Fri Sep 16 10:49:36 2022 -0500

lvmdbustest: Remove force exception in _wait_for_job

We put this in to test one of the paths in the damon, but unfortunately
if we hit the race condition where the job actually is done we will try
to call j.Wait(1) after the remove.  This fails with:

dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod:
Method "Wait" with signature "i" on interface "com.redhat.lvmdbus1.Job"
doesn't exist

Which is caused by the dbus object no longer existing.  We could handle
this, but the issue is we no longer have the ability to get the result to
return, they have been lost.

A better solution would be to write a specific unit test to force this code
path and handle all the possible outcomes.
---
 test/dbus/lvmdbustest.py | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index 02d4d35d7..e7df238ce 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -900,16 +900,6 @@ class TestDbusService(unittest.TestCase):
 				j.Remove()
 
 				break
-			else:
-				# Most of the time we will get this exception as expected, but there is
-				# a race condition between checking if it's complete and removing it (we want to try to remove while
-				# it's not complete to raise the exception)
-				# Thus, we can't reliably use self.assertRaises.
-				# We have included it here to test this path in the daemon.
-				try:
-					j.Remove()
-				except dbus.exceptions.DBusException:
-					pass
 
 			if j.Wait(1):
 				self.assertTrue(j.Wait(0))


                 reply	other threads:[~2022-09-19 15:57 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=20220919155751.156DE3858C54@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.