No flags found
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
319cfef
... +1 ...
ef5c826
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
384 | 384 | "Found a match but no valid date/time found", |
|
385 | 385 | "Match without a timestamp:", all=True) |
|
386 | 386 | ||
387 | - | self.pruneLog() |
|
387 | + | def testIncompleteDateTime(self): |
|
388 | + | # datepattern in followed lines doesn't match previously known pattern + line is too short |
|
389 | + | # (logging break-off, no flush, etc): |
|
390 | + | self.assertTrue(_test_exec( |
|
391 | + | '-o', 'Found-ADDR:<ip>', |
|
392 | + | '192.0.2.1 - - [02/May/2021:18:40:55 +0100] "GET / HTTP/1.1" 302 328 "-" "Mozilla/5.0" "-"\n' |
|
393 | + | '192.0.2.2 - - [02/May/2021:18:40:55 +0100\n' |
|
394 | + | '192.0.2.3 - - [02/May/2021:18:40:55', |
|
395 | + | '^<ADDR>')) |
|
396 | + | self.assertLogged( |
|
397 | + | "Found-ADDR:192.0.2.1", "Found-ADDR:192.0.2.2", "Found-ADDR:192.0.2.3", all=True) |
|
388 | 398 | ||
389 | 399 | def testFrmtOutputWrapML(self): |
|
390 | 400 | unittest.F2B.SkipIfCfgMissing(stock=True) |
104 | 104 | ||
105 | 105 | # more precise year patterns, within same century of last year and |
|
106 | 106 | # the next 3 years (for possible long uptime of fail2ban); thereby |
|
107 | - | # respect possible run in the test-cases (alternate date used there): |
|
108 | - | if MyTime.alternateNowTime != 0: |
|
109 | - | timeRE['ExY'] = r"(?P<Y>%s\d)" % _getYearCentRE(cent=(0,3), distance=3) |
|
110 | - | timeRE['Exy'] = r"(?P<y>%s\d)" % _getYearCentRE(cent=(2,3), distance=3) |
|
111 | - | else: # accept years: 19xx|2xxx up to current century |
|
112 | - | timeRE['ExY'] = r"(?P<Y>(?:19\d{2}|%s\d))" % _getYearCentRE(cent=(0,3), distance=3, |
|
113 | - | now=(MyTime.now(), datetime.datetime.fromtimestamp(978393600))) |
|
114 | - | timeRE['Exy'] = r"(?P<y>\d{2})" |
|
107 | + | # consider possible run in the test-cases (alternate date used there), |
|
108 | + | # so accept years: 20xx (from test-date or 2001 up to current century) |
|
109 | + | timeRE['ExY'] = r"(?P<Y>%s\d)" % _getYearCentRE(cent=(0,3), distance=3, |
|
110 | + | now=(datetime.datetime.now(), datetime.datetime.fromtimestamp( |
|
111 | + | min(MyTime.alternateNowTime or 978393600, 978393600)) |
|
112 | + | ) |
|
113 | + | ) |
|
114 | + | timeRE['Exy'] = r"(?P<y>\d{2})" |
|
115 | 115 | ||
116 | 116 | _updateTimeRE() |
|
117 | 117 |
365 | 365 | # with space or some special char), otherwise possible collision/pattern switch: |
|
366 | 366 | if (( |
|
367 | 367 | line[distance-1:distance] == self.__lastPos[1] or |
|
368 | - | (line[distance] == self.__lastPos[2] and not self.__lastPos[2].isalnum()) |
|
368 | + | (line[distance:distance+1] == self.__lastPos[2] and not self.__lastPos[2].isalnum()) |
|
369 | 369 | ) and ( |
|
370 | 370 | line[endpos:endpos+1] == self.__lastEndPos[2] or |
|
371 | - | (line[endpos-1] == self.__lastEndPos[1] and not self.__lastEndPos[1].isalnum()) |
|
371 | + | (line[endpos-1:endpos] == self.__lastEndPos[1] and not self.__lastEndPos[1].isalnum()) |
|
372 | 372 | )): |
|
373 | 373 | # search in line part only: |
|
374 | 374 | log(logLevel-1, " boundaries are correct, search in part %r", line[distance:endpos]) |
Learn more Showing 2 files with coverage changes found.
fail2ban/server/strptime.py
fail2ban/server/utils.py
ef5c826
2918849
319cfef