cfme.utils.log_validator module

class cfme.utils.log_validator.LogValidator(remote_filename, **kwargs)[source]

Bases: object

Log content validator class provides methods to fix the log content before test is started, and validate the content of log during test execution, according to predefined patterns. Predefined patterns are:

  • Logs which should be skipped. Skip further checks on particular line if matched
  • Logs which should cause failure of test.
  • Logs which are expected to be matched, otherwise fail.

The priority of patterns to be checked are defined in above order. Skipping patterns have priority over other ones, to be possible to skip particular ERROR log, but fail for wider range of other ERRORs.

Parameters:
  • remote_filename – path to the remote log file
  • skip_patterns – array of skip regex patterns
  • failure_patterns – array of failure regex patterns
  • matched_patterns – array of expected regex patterns to be matched

Usage:

.. code-block:: python
  evm_tail = LogValidator('/var/www/miq/vmdb/log/evm.log',
                          skip_patterns=['PARTICULAR_ERROR'],
                          failure_patterns=['.*ERROR.*'],
                          matched_patterns=['PARTICULAR_INFO'])
  evm_tail.fix_before_start()
  evm_tail.validate_logs()
fix_before_start()[source]
validate_logs()[source]