Skip to content

Commit

Permalink
test: Only run alert and logout cleanups if Cockpit is actually opened
Browse files Browse the repository at this point in the history
Some tests like `testAddDiskNFS` fail during setup [1], so the test
teardown runs while the browser still shows a blank page.

Use the new `Browser.have_test_api()` from
cockpit-project/cockpit#21349 instead of merely
checking if the browser is running to clean that up.

[1] cockpit-project/bots#7137
  • Loading branch information
martinpitt committed Nov 29, 2024
1 parent a5470ef commit b276f3f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ COCKPIT_REPO_FILES = \
$(NULL)

COCKPIT_REPO_URL = https://github.com/cockpit-project/cockpit.git
COCKPIT_REPO_COMMIT = 7090fab7372ef7e87e508d207e6468ba76983f9f # 329 + 58 commits
COCKPIT_REPO_COMMIT = b453940e6a7cde684832d750ba56d4afd44a699e # 329 + 66 commits

$(COCKPIT_REPO_FILES): $(COCKPIT_REPO_STAMP)
COCKPIT_REPO_TREE = '$(strip $(COCKPIT_REPO_COMMIT))^{tree}'
Expand Down
4 changes: 2 additions & 2 deletions test/machineslib.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ def stop_all():
self.allow_journal_messages(r".* couldn't get all properties of org.freedesktop.NetworkManager.Device at /org/freedesktop/NetworkManager/Devices/\d+: Timeout was reached") # noqa: E501

# avoid error noise about resources getting cleaned up
self.addCleanup(lambda: not self.browser.valid or self.browser.logout())
self.addCleanup(lambda: not self.browser.have_test_api() or self.browser.logout())

# noVNC warns about this for non-TLS connections; for RHEL downstream testing
self.allow_browser_errors("noVNC requires a secure context")
Expand Down Expand Up @@ -557,7 +557,7 @@ def downloadVmsArtifacts(self):

def tearDown(self):
b = self.browser
if b.valid and b.is_present("#button.alert-link.more-button"):
if b.have_test_api() and b.is_present("#button.alert-link.more-button"):
b.click("button.alert-link.more-button")

if self.getError():
Expand Down

0 comments on commit b276f3f

Please sign in to comment.