Skip to content

Commit 7eff27b

Browse files
mvollmermartinpitt
authored andcommitted
test: Retry realmd operation if another is still active
Cherry-picked from master commit c45d993 Closes #14197
1 parent 348127f commit 7eff27b

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

test/verify/check-realms

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -235,18 +235,31 @@ class TestRealms(MachineCase):
235235
# should have stopped cert tracking
236236
self.assertNotIn("status:", m.execute("ipa-getcert list"))
237237

238-
# Send a wrong password
239-
b.click("#system-info-domain a")
240-
b.wait_popup("realms-op")
241-
b.set_val(self.op_address, "cockpit.lan")
242-
b.wait_attr(self.op_admin, "placeholder", 'e.g. "admin"')
243-
b.set_val(self.op_admin, "admin")
244-
b.set_val(self.op_admin_password, "foo")
245-
b.click(".realms-op-apply")
246-
b.wait_text_not(".realms-op-message", "")
247-
b.wait_not_visible(".realms-op-leave-only-row")
248-
b.click(".realms-op-cancel")
249-
b.wait_popdown("realms-op")
238+
# Sometimes with some versions of realmd the Leave operation
239+
# from above is still active in the realmd daemon. So we loop
240+
# here until we get the expected error instead of "Already
241+
# running another action".
242+
243+
tries = 0
244+
while tries < 3:
245+
# Send a wrong password
246+
b.click("#system-info-domain a")
247+
b.wait_popup("realms-op")
248+
b.set_val(self.op_address, "cockpit.lan")
249+
b.wait_attr(self.op_admin, "placeholder", 'e.g. "admin"')
250+
b.set_val(self.op_admin, "admin")
251+
b.set_val(self.op_admin_password, "foo")
252+
b.click(".realms-op-apply")
253+
b.wait_text_not(".realms-op-message", "")
254+
error = b.text(".realms-op-message")
255+
b.wait_not_visible(".realms-op-leave-only-row")
256+
b.click(".realms-op-cancel")
257+
b.wait_popdown("realms-op")
258+
if not "Already running another action" in error:
259+
break
260+
print("Another operation running, retry")
261+
time.sleep(20)
262+
tries += 1
250263

251264
# Try to join a non-existing domain
252265
b.click("#system-info-domain a")

0 commit comments

Comments
 (0)