-
- # Waiting for 5 secs to be sure that the file is downloaded
- yield from asyncio.sleep(5, loop=self.loop)
- xpath = "/download-jobs/job[download-id='{}']".format(
- download_id)
- result = yield from self.read_xpath(xpath)
- self.log.debug("Test result before complete check - %s", result)
+
+ # Waiting to be sure that the file is downloaded
+ # From BLR, it sometimes take longer for the file to
+ # be downloaded
+ max_time = 60
+ total_time = 0
+ while True:
+ yield from asyncio.sleep(5, loop=self.loop)
+ xpath = self.project.add_project("/download-jobs/job[download-id='{}']".
+ format(download_id))
+ result = yield from self.read_xpath(xpath)
+ self.log.debug("Test result before complete check - %s", result)
+ if result.status != "COMPLETED":
+ total_time = total_time + 5
+ if total_time <= max_time:
+ continue
+ else:
+ break
+