Skip to content

Commit

Permalink
test: Fix testHealthcheck table queries
Browse files Browse the repository at this point in the history
Since cockpit-project/cockpit@1a903b480a0 each
table row (health check entry) gets its own `<tbody>`

Also fix the bogus nth-child index in the initial "passed health run"
check -- we expect exactly one run there.

Strengthen the "trigger run manually" checks -- ensure that this second run
also gets a green badge and that there isn't a third run.
  • Loading branch information
martinpitt committed Jan 11, 2024
1 parent 3d1a49a commit 31a410f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions test/check-application
Original file line number Diff line number Diff line change
Expand Up @@ -2432,13 +2432,15 @@ class TestApplication(testlib.MachineCase):
self.assertEqual(self.execute(auth, "podman inspect --format '{{.Config.Healthcheck}}' healthy").strip(),
"{[true] 5s 5m25s 35s 2}")

# single successful health check
b.wait_in_text(".ct-listing-panel-body tbody tr", "Passed health run")
b.wait_not_present(".ct-listing-panel-body tbody tr:nth-child(2)")
b.wait_visible(".ct-listing-panel-body tbody:nth-child(2) svg.green")
b.wait_visible(".ct-listing-panel-body tbody:nth-of-type(1) svg.green")
b.wait_not_present(".ct-listing-panel-body tbody:nth-of-type(2)")

# Trigger run manually
# Trigger run manually, adds one more healthy run
self.performContainerAction("healthy", "Run health check")
b.wait_visible(".ct-listing-panel-body tbody tr:nth-child(2)")
b.wait_visible(".ct-listing-panel-body tbody:nth-of-type(2) svg.green")
b.wait_not_present(".ct-listing-panel-body tbody:nth-of-type(3)")

self.toggleExpandedContainer("healthy")

Expand All @@ -2454,9 +2456,9 @@ class TestApplication(testlib.MachineCase):

self.toggleExpandedContainer("sick")
b.click(".pf-m-expanded button:contains('Health check')")
b.wait_visible(".pf-m-expanded .ct-listing-panel-body tbody tr:nth-child(1)")
b.wait_visible(".pf-m-expanded .ct-listing-panel-body tbody tr:nth-child(4)")
b.wait_visible(".pf-m-expanded .ct-listing-panel-body tbody tr:nth-child(2) svg.red")
b.wait_visible(".pf-m-expanded .ct-listing-panel-body tbody:nth-of-type(1)")
b.wait_visible(".pf-m-expanded .ct-listing-panel-body tbody:nth-of-type(4)")
b.wait_visible(".pf-m-expanded .ct-listing-panel-body tbody:nth-of-type(2) svg.red")
b.wait_visible('.pf-m-expanded #container-details-healthcheck dt:contains("Failing streak")')
failures = int(b.text('.pf-m-expanded #container-details-healthcheck dt:contains("Failing streak") + dd'))
self.assertGreater(failures, 3)
Expand Down

0 comments on commit 31a410f

Please sign in to comment.