def watch_log_for_no_errors()

in ccmlib/node.py [0:0]


    def watch_log_for_no_errors(self, exprs, from_mark=None, timeout=600, process=None, verbose=False, filename='system.log'):
        """
        Watch the log until one or more (regular) expressions are found or timeouts (a
        TimeoutError is then raised). On successful completion, a list of pair (line matched,
        match object) is returned.

        This method is different from watch_log_for as it will raise a AssertionError if the
        log contain an error; this assertion will contain the errors found in the log.
        """
        start = time.time()
        tofind = [exprs] if isinstance(exprs, string_types) else exprs
        tofind = [re.compile(e) for e in tofind]
        seek_start=0
        if from_mark:
            seek_start = from_mark
        while True:
            TimeoutError.raise_if_passed(start=start, timeout=timeout, node=self.name,
                                         msg="Missing: {exprs} not found in {f}".format(
                                             exprs=[e.pattern for e in tofind], f=filename))
            try:
                # process is bin/cassandra so choosing to ignore this argument to avoid early termination
                return self.watch_log_for(tofind, from_mark=from_mark, timeout=5, verbose=verbose, filename=filename)
            except TimeoutError:
                logger.debug("waited 5s watching for '{}' but was not found; checking for errors".format(tofind))
                # since the api doesn't return the mark read it isn't thread safe to use mark
                # as the length of the file can change between calls which may mean we skip over
                # errors; to avoid this keep reading the whole file over and over again...
                # unless a explicit mark is given to the method, will read from that offset
                errors = self.grep_log_for_errors_from(filename=filename, seek_start=seek_start)
                if errors:
                    msg = "Errors were found in the logs while watching for '{}'; attempting to fail the test".format(tofind)
                    logger.debug(msg)
                    raise AssertionError("{}:\n".format(msg) + '\n\n'.join(['\n'.join(msg) for msg in errors]))