summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hows <howsdav@gmail.com>2017-07-25 14:26:11 +1000
committerAlex Gorrod <alexander.gorrod@mongodb.com>2017-07-25 14:26:10 +1000
commit58a2c6ce5681d8357944466f2d11a9e0d14cdddb (patch)
tree6767c0b15dc98001fa1b046bc128aacea0a996ef
parent99977a03a145415235629cbf25c298f5e580d4ff (diff)
downloadmongo-58a2c6ce5681d8357944466f2d11a9e0d14cdddb.tar.gz
WT-3447 Fix python test so it will loop checking for WiredTigerTables (#3532)
To give time for the statistics log thread to write into the file, not just create it.
-rw-r--r--test/suite/test_stat_log02.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/test/suite/test_stat_log02.py b/test/suite/test_stat_log02.py
index 322092c8190..e85b64721df 100644
--- a/test/suite/test_stat_log02.py
+++ b/test/suite/test_stat_log02.py
@@ -96,16 +96,21 @@ class test_stat_log02(wttest.WiredTigerTestCase):
json.loads(line)
def check_file_contains_tables(self, dir):
- files = glob.glob(dir + '/' + 'WiredTigerStat.[0-9]*')
- f = open(files[0], 'r')
- has_tables = False
- for line in f:
- data = json.loads(line)
- if "wiredTigerTables" in data:
- if "file:foo.wt" in data["wiredTigerTables"]:
- has_tables = True
+ # We wait for another 30 sleeps here to avoid erroring in the case where
+ # the stat log has only made the first pass and not yet printed the
+ # individual table stats.
+ number_sleeps = 0
+ while True:
+ files = glob.glob(dir + '/' + 'WiredTigerStat.[0-9]*')
+ f = open(files[0], 'r')
+ for line in f:
+ data = json.loads(line)
+ if "wiredTigerTables" in data:
+ if "file:foo.wt" in data["wiredTigerTables"]:
+ return
- self.assertTrue(has_tables)
+ number_sleeps += 1
+ self.assertLess(number_sleeps, 30)
if __name__ == '__main__':
wttest.run()