Patchwork [1,of,6] tests: add a substitution pattern for HTTP error log dates

login
register
mail settings
Submitter Matt Harbison
Date April 9, 2018, 4:26 a.m.
Message ID <69ead78af94459ca41e5.1523248001@Envy>
Download mbox | patch
Permalink /patch/30580/
State Accepted
Headers show

Comments

Matt Harbison - April 9, 2018, 4:26 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1523121020 14400
#      Sat Apr 07 13:10:20 2018 -0400
# Node ID 69ead78af94459ca41e529d0ebfb24bd1d11c32c
# Parent  d83191e9749ba281b569ed67ad345406cedb095d
tests: add a substitution pattern for HTTP error log dates

This will make tests with error log content less of a nuisance.  I didn't roll
it into to $LOGDATE$ because the regex got long and line wrapped.  It didn't
seem worth the obscurity.

Patch

diff --git a/tests/common-pattern.py b/tests/common-pattern.py
--- a/tests/common-pattern.py
+++ b/tests/common-pattern.py
@@ -71,10 +71,14 @@  substitutions = [
      # (replacement patterns)
      br'$USUAL_BUNDLE2_CAPS_SERVER$'
      ),
-    # HTTP log dates
+    # HTTP access log dates
     (br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] "(GET|PUT|POST)',
      lambda m: br' - - [$LOGDATE$] "' + m.group(1)
     ),
+    # HTTP error log dates
+    (br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] (HG error:|Exception)',
+     lambda m: br' - - [$ERRDATE$] ' + m.group(1)
+    ),
     # HTTP header dates- RFC 1123
     (br'([Dd]ate): [A-Za-z]{3}, \d\d [A-Za-z]{3} \d{4} \d\d:\d\d:\d\d GMT',
      lambda m: br'%s: $HTTP_DATE$' % m.group(1)