From ea8a8ecb280abffb4d28854310ebeacaa7985e70 Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Sat, 13 Jan 2024 14:44:48 -0500 Subject: [PATCH] Fix wait_until_uploads_idle --- system_test/e2e/helpers.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/system_test/e2e/helpers.py b/system_test/e2e/helpers.py index 316cc35e..f6b65178 100644 --- a/system_test/e2e/helpers.py +++ b/system_test/e2e/helpers.py @@ -413,17 +413,25 @@ class Node(object): ''' Wait until uploads go idle. ''' - backups = self.num_auto_backups()[0] - skipped = self.num_auto_backups()[2] - skipped_sum = self.num_auto_backups()[3] - total_skipped = skipped + skipped_sum t = 0 while t < timeout: - # No change in backups, and the other backups are being skipped? - if self.num_auto_backups()[0] == backups and (self.num_auto_backups()[2] + self.num_auto_backups()[3]) >total_skipped: - return self.num_auto_backups() - time.sleep(0.1) - t+=1 + backups = self.num_auto_backups()[0] + skipped = self.num_auto_backups()[2] + skipped_sum = self.num_auto_backups()[3] + time.sleep(0.5) + if self.num_auto_backups()[1] + self.num_auto_backups()[2] == skipped + skipped_sum: + # Skipped uploads are not increasing, so uploads are not idle + t+=1 + continue + + # OK, skipped backups are increasing, but has the number of backups stayed the same? + if self.num_auto_backups()[0] != backups: + t+=1 + continue + + # Backups are idle + return self.num_auto_backups() + n = self.num_auto_backups() raise Exception('rqlite node failed to idle backups within %d seconds (%d, %d, %d, %d)' % (timeout, n[0], n[1], n[2], n[3]))