Skip to content

Commit

Permalink
test: Retry after UDisks2 timeout in TestStorageUsed.testUsed
Browse files Browse the repository at this point in the history
It is not clear what exactly keeps /dev/sda1 busy when the kernel
tries to read the new partition table. It can't be the artificial
processes and services started by the test itself since unmounting and
locking have already succeeded at that point.

This bug happens only in quite specific conditions, and can't be
expected to ever get fixed. So let's do what every user would do as
well: Retry the dialog.
  • Loading branch information
mvollmer authored and martinpitt committed Nov 7, 2023
1 parent cbc151c commit 530c70d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/verify/check-storage-used
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,21 @@ ExecStart=/usr/bin/sleep infinity
b.wait_visible("#dialog tbody:first-of-type button:contains(Currently in use)")
b.assert_pixels('#dialog', "format-disk")
self.dialog_apply()
self.dialog_wait_close()
try:
self.dialog_wait_close()
except testlib.Error:
if "Timed out waiting for object" in b.text("#dialog"):
# Sometimes /dev/sda1 is still held open by something
# immediately after locking it. This prevents the
# kernel from reading the new partition table. Let's
# just try again.
print("WARNING: Retrying partition table creation")
self.dialog_cancel()
self.dialog_wait_close()
b.click('button:contains(Create partition table)')
self.confirm()
else:
raise

m.execute("! systemctl --quiet is-active keep-mnt-busy")

Expand Down

0 comments on commit 530c70d

Please sign in to comment.