test: Fix testOverview flake

On loaded machines, the Memory usage bar sometimes does not drop below
the initial usage afer 8s, but it takes a little longer. Robustify this
by waiting for the usage to drop, instead of expecting a fixed point in
time.

Fixes #13370
Closes #13385
This commit is contained in:
Martin Pitt 2020-01-13 12:36:11 +01:00 committed by GitHub
parent 8a0edfbc4a
commit 0b949fcbbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -237,10 +237,8 @@ class TestMetrics(MachineCase):
m.execute("kill %d" % mem_hog)
# should go back to initial_usage; often below, due to paged out stuff
time.sleep(8)
last_usage = progressValue(2)
self.assertLessEqual(last_usage, initial_usage)
self.assertGreater(last_usage, 10)
wait(lambda: progressValue(2) <= initial_usage)
self.assertGreater(progressValue(2), 10)
if __name__ == '__main__':