Skip to content

Commit

Permalink
test: Improve waiting in software update tests
Browse files Browse the repository at this point in the history
Instead of waiting for a fixed amount of time, we
can wait for a lock file to appear.
That way, the calling test process has control over
when (and if) the package installation should finish.

Closes #7328
  • Loading branch information
dperpeet authored and martinpitt committed Jul 19, 2017
1 parent f50d03d commit 9ceaa95
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/verify/check-packagekit
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,10 @@ class TestUpdates(MachineCase):
b = self.browser
m = self.machine

install_lockfile = "/tmp/finish-pk"
# updating this package takes longer than a cockpit start and building the page
self.createPackage("slow", "1", "1", install=True)
self.createPackage("slow", "1", "2", postinst='sleep 10')
self.createPackage("slow", "1", "2", postinst="while [ ! -e {0} ]; do sleep 1; done; rm -f {0}".format(install_lockfile))
self.enableRepo()
m.execute("pkcon refresh")

Expand All @@ -361,6 +362,9 @@ class TestUpdates(MachineCase):
b.wait_in_text("#state", "Applying updates")
b.wait_present("#app div.progress-bar")

# finish the package installation
m.execute("touch {0}".format(install_lockfile))

# should have succeeded and show restart page; cancel
b.wait_present("#app .container-fluid h1")
b.wait_in_text("#app .container-fluid h1", "Restart Recommended")
Expand Down Expand Up @@ -392,7 +396,8 @@ class TestUpdates(MachineCase):

# make sure we have enough time to crash PK
self.createPackage("slow", "1", "1", install=True)
self.createPackage("slow", "1", "2", postinst='sleep 10')
# we don't want this installation to finish
self.createPackage("slow", "1", "2", postinst="sleep infinity")
self.enableRepo()
m.execute("pkcon refresh")

Expand Down

0 comments on commit 9ceaa95

Please sign in to comment.