1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

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.
This commit is contained in:
Tony Asleson 2022-08-09 17:36:54 -05:00
parent 3fdf449348
commit ea45ba753e

View File

@ -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))