MCPcopy Create free account
hub / github.com/ceph/ceph / __exit__

Method __exit__

qa/tasks/ceph_test_case.py:230–255  ·  view source on GitHub ↗
(self, exc_type, exc_val, exc_tb)

Source from the content-addressed store, hash-verified

228 self.watcher_process = ceph_manager.run_ceph_w(watch_channel)
229
230 def __exit__(self, exc_type, exc_val, exc_tb):
231 fail = False
232 if not self.watcher_process.finished:
233 # Check if we got an early match, wait a bit if we didn't
234 if present and self.match():
235 return
236 elif not present and self.match():
237 fail = True
238 else:
239 log.debug("No log hits yet, waiting...")
240 # Default monc tick interval is 10s, so wait that long and
241 # then some grace
242 time.sleep(5 + timeout)
243
244 self.watcher_process.stdin.close()
245 try:
246 self.watcher_process.wait()
247 except CommandFailedError:
248 pass
249
250 if present and not self.match():
251 log.error(f"Log output: \n{self.watcher_process.stdout.getvalue()}\n")
252 raise AssertionError(f"Expected log message not found: '{expected_pattern}'")
253 elif fail or (not present and self.match()):
254 log.error(f"Log output: \n{self.watcher_process.stdout.getvalue()}\n")
255 raise AssertionError(f"Unexpected log message found: '{expected_pattern}'")
256
257 return ContextManager()
258

Callers

nothing calls this directly

Calls 6

matchMethod · 0.95
debugMethod · 0.45
sleepMethod · 0.45
closeMethod · 0.45
waitMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected