This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 52e6ecc2e7 Add test of transaction logging to ip_allow Au test. 
(#10108)
52e6ecc2e7 is described below

commit 52e6ecc2e74dead1c28708f7f6d94e8d31ad2049
Author: Walt Karas <[email protected]>
AuthorDate: Mon Aug 7 10:36:03 2023 -0400

    Add test of transaction logging to ip_allow Au test. (#10108)
---
 tests/gold_tests/ip_allow/gold/log.gold    |  3 +++
 tests/gold_tests/ip_allow/ip_allow.test.py | 12 +++++++++++-
 tests/gold_tests/ip_allow/run_sed.sh       | 21 +++++++++++++++++++++
 3 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/tests/gold_tests/ip_allow/gold/log.gold 
b/tests/gold_tests/ip_allow/gold/log.gold
new file mode 100644
index 0000000000..ef04bf8bb3
--- /dev/null
+++ b/tests/gold_tests/ip_allow/gold/log.gold
@@ -0,0 +1,3 @@
+127.0.0.1 TCP_MISS/200 130 GET https://127.0.0.1:SOMEPORT/get DIRECT - - - 
127.0.0.1:SOMEPORT -  sftover=- sftmat=- sftcls=- sftbadclf=- yra=- scheme=http
+127.0.0.1 ERR_PROXY_DENIED/403 453 CONNECT 127.0.0.1:SOMEPORT/connect DIRECT 
text/html - - 127.0.0.1:SOMEPORT -  sftover=- sftmat=- sftcls=- sftbadclf=- 
yra=- scheme=UNKNOWN
+127.0.0.1 ERR_PROXY_DENIED/403 453 PUSH https://127.0.0.1:SOMEPORT/h2_push 
DIRECT text/html - - 127.0.0.1:SOMEPORT -  sftover=- sftmat=- sftcls=- 
sftbadclf=- yra=- scheme=https
diff --git a/tests/gold_tests/ip_allow/ip_allow.test.py 
b/tests/gold_tests/ip_allow/ip_allow.test.py
index b794fbf8b9..ce21a36162 100644
--- a/tests/gold_tests/ip_allow/ip_allow.test.py
+++ b/tests/gold_tests/ip_allow/ip_allow.test.py
@@ -17,6 +17,8 @@ Verify ip_allow filtering behavior.
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
+import os
+
 Test.Summary = '''
 Verify ip_allow filtering behavior.
 '''
@@ -95,7 +97,7 @@ ts.Disk.records_config.update({
 })
 
 format_string = ('%<cqtd>-%<cqtt> %<stms> %<ttms> %<chi> %<crc>/%<pssc> 
%<psql> '
-                 '%<cqhm> %<pquc> %<phr>/%<pqsn> %<psct> %<{Y-RID}pqh> '
+                 '%<cqhm> %<pquc> %<phr> %<psct> %<{Y-RID}pqh> '
                  '%<{Y-YPCS}pqh> %<{Host}cqh> %<{CHAD}pqh>  '
                  'sftover=%<{x-safet-overlimit-rules}cqh> 
sftmat=%<{x-safet-matched-rules}cqh> '
                  'sftcls=%<{x-safet-classification}cqh> '
@@ -175,3 +177,11 @@ tr.Processes.Default.ReturnCode = 0
 tr.Processes.Default.Streams.stderr = 'gold/403_h2.gold'
 tr.StillRunningAfter = ts
 tr.StillRunningAfter = server
+
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = (
+    os.path.join(Test.Variables.AtsTestToolsDir, 'stdout_wait') + ' 60 "{} {}" 
{}'.format(
+        os.path.join(Test.TestDirectory, 'run_sed.sh'), 
os.path.join(ts.Variables.LOGDIR, 'squid.log'),
+        os.path.join(Test.TestDirectory, 'gold/log.gold'))
+)
+tr.Processes.Default.ReturnCode = 0
diff --git a/tests/gold_tests/ip_allow/run_sed.sh 
b/tests/gold_tests/ip_allow/run_sed.sh
new file mode 100755
index 0000000000..2d3ac39a1d
--- /dev/null
+++ b/tests/gold_tests/ip_allow/run_sed.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+# The first sed command in the pipeline eliminates the first 3 log fields from 
each log line.
+
+sed 's/^[^ ]* [^ ]* [^ ]* //' < $1 | sed 
's/:[0-9][0-9]*\([^0-9]\)/:SOMEPORT\1/g'

Reply via email to