def test_bgrep(): """validates bgrep matches every line""" b = BucketGrep( 'main', files=[os.path.join(current_dir(__file__), 'testdata', 'simple.log')]) b.analyze() assert len(b.matches) == 2
def test_bgrep(self): """validates bgrep matches every line""" b = BucketGrep( "main", files=[ os.path.join(current_dir(__file__), "testdata", "simple.log") ], ) b.analyze() self.assertEqual(len(b.matches), 2)
def test_nodate(self): """validates bgrep matches lines without a date""" b = BucketGrep( ".*No such file or directory.*", files=[ os.path.join(current_dir(__file__), "testdata", "traceback.log") ], ) b.analyze() self.assertEqual(len(b.matches), 1)
def test_no_matches(self): """should match no rows""" b = BucketGrep( "this should never match anything", files=[ os.path.join(current_dir(__file__), "testdata", "statusloggernew_debug.log") ], ) b.analyze() self.assertFalse(b.matches)
def test_bgrep_when_statuslogger_lines_present(self): """statuslogger matching maybe breaking bgrep""" b = BucketGrep( "RANGE_SLICE messages were dropped", files=[ os.path.join(current_dir(__file__), "testdata", "statusloggernew_debug.log") ], ) b.analyze() self.assertEqual(len(b.matches), 1)
def run(args): """ run bgrep """ files = None if args.files: files = args.files.split(',') b = BucketGrep(args.regex, diag_dir=args.diag_dir, files=files, start=args.start, end=args.end, ignorecase=not args.case) b.print_report(interval=args.interval)
def test_nodate(): """validates bgrep matches lines without a date""" b = BucketGrep('.*No such file or directory.*', \ files=[os.path.join(current_dir(__file__), 'testdata', 'traceback.log')]) b.analyze() assert len(b.matches) == 1
def test_no_matches(): """should match no rows""" b = BucketGrep('this should never match anything', \ files=[os.path.join(current_dir(__file__), 'testdata', 'statusloggernew_debug.log')]) b.analyze() assert not b.matches
def test_bgrep_when_statuslogger_lines_present(): """statuslogger matching maybe breaking bgrep""" b = BucketGrep('RANGE_SLICE messages were dropped', \ files=[os.path.join(current_dir(__file__), 'testdata', 'statusloggernew_debug.log')]) b.analyze() assert len(b.matches) == 1