Part of lp.services.mailman.testing.logwatcher View In Hierarchy
Known subclasses: lp.services.mailman.testing.logwatcher.BounceWatcher, lp.services.mailman.testing.logwatcher.ErrorWatcher, lp.services.mailman.testing.logwatcher.MHonArcWatcher, lp.services.mailman.testing.logwatcher.QrunnerWatcher, lp.services.mailman.testing.logwatcher.SMTPDWatcher, lp.services.mailman.testing.logwatcher.VetteWatcher, lp.services.mailman.testing.logwatcher.XMLRPCWatcher
You MUST open the LogWatcher before any data you're interested in could get written to the log.
This class (and its subclasses) are how we ensure synchronization among the various independent processes involved in the tests. Without this synchronization, our tests are subject to highly unstable race conditions.
The various wait*() methods in the subclasses are called to wait for an expected landmark written to a log file. For example, if we're waiting for the delivery of an email message with the Message-ID: <zulu>, we never know exactly when the other process will write this. We /do/ know that once that landmark is written, the state we expect to test will exist.
This is safe because we have only one process writing to any particular log file, and that process is single threaded. Further, the messages it writes will always be in a predictable order, so this is a reliable synchronization point.
Set expecting_timeout to True on the watcher instance just before a
wait*() call if you expect a time out. This will suppress any logging
information normally printed when a time out occurs. expecting_timeout
is automatically reset to False after the time out occurs.
| Method | __init__ | Undocumented |
| Method | annotate | Annotate the log by writing the message to it. |
| Method | lines | Keep a cache of the lines read from the file. |
| Method | wait | Wait until the landmark string has been seen. |
| Method | close | Undocumented |
This is mostly for debugging purposes.