Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishevent
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
varnishevent
Commits
31354784
Commit
31354784
authored
Mar 07, 2018
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
keep output files upon failure, simplify
parent
adfb6e38
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
56 deletions
+24
-56
ncsa.sh
src/test/ncsa.sh
+24
-56
No files found.
src/test/ncsa.sh
View file @
31354784
#!/bin/bash
function
diffem
()
{
local
what
=
"
${
1
}
"
;
shift
;
if
!
diff
"
${
@
}
"
;
then
echo
"ERROR:
${
what
}
differ"
echo
" see
${
@
}
"
exit
1
fi
rm
-f
"
${
@
}
"
}
# Outputs of varnishevent and varnishncsa for client formats are
# identical, except that varnishevent emits empty strings for data
# from headers that are empty, and varnishnca emits a '-'.
...
...
@@ -24,21 +36,12 @@ EVENT_LOG=$TMP/event.log
NCSA_LOG
=
$TMP
/ncsa.log
INPUT
=
varnish-4.1.0-doc.log
DIFF_CMD
=
"diff
$EVENT_LOG
$NCSA_LOG
"
echo
"... default format"
$EVENT
-r
$INPUT
|
sed
's/-//g'
>
$EVENT_LOG
$NCSA
-r
$INPUT
|
sed
's/-//g'
>
$NCSA_LOG
$DIFF_CMD
RC
=
$?
rm
$EVENT_LOG
rm
$NCSA_LOG
if
[
"
$RC
"
-ne
"0"
]
;
then
echo
"ERROR: outputs of no-arg varnishevent and varnishncsa differ"
exit
1
fi
diffem
"outputs of no-arg varnishevent and varnishncsa"
\
$EVENT_LOG
$NCSA_LOG
# Cannot test the %D formatter, because varnishevent gets it more accurately
# (varnishncsa has floating point errors).
...
...
@@ -48,15 +51,8 @@ echo "... custom -F format"
$EVENT
-r
$INPUT
-F
"
$FORMAT
"
|
sed
's/-//g'
>
$EVENT_LOG
$NCSA
-r
$INPUT
-F
"
$FORMAT
"
|
sed
's/-//g'
>
$NCSA_LOG
$DIFF_CMD
RC
=
$?
rm
$EVENT_LOG
rm
$NCSA_LOG
if
[
"
$RC
"
-ne
"0"
]
;
then
echo
"ERROR: outputs of varnishevent/varnishncsa -F differ"
exit
1
fi
diffem
"outputs of varnishevent/varnishncsa -F"
\
$EVENT_LOG
$NCSA_LOG
FORMAT
=
'%b %H %h %I %{Host}i %{User-Agent}i %{X-Forwarded-For}i %{Accept-Ranges}o %{Connection}o %{Content-Encoding}o %{Content-Length}o %{Content-Type}o %{Date}o %{Last-Modified}o %{ETag}o %{Server}o %l %m %O %q %r %s %t %{%F-%T}t %U %u %{Varnish:time_firstbyte}x %{VSL:Begin}x %{VSL:End}x %{VSL:Link}x %{VSL:Timestamp}x %{Varnish:vxid}x %{Varnish:side}x'
...
...
@@ -66,15 +62,8 @@ echo "... client and backend logging"
$EVENT
-r
$INPUT
-f
backend_client.conf |
tail
-n
+2 |
sed
's/-//g'
>
$EVENT_LOG
$NCSA
-r
$INPUT
-F
"
$FORMAT
"
-b
-c
|
sed
's/-//g; s/\\"/"/g'
>
$NCSA_LOG
$DIFF_CMD
RC
=
$?
rm
$EVENT_LOG
rm
$NCSA_LOG
if
[
"
$RC
"
-ne
"0"
]
;
then
echo
"ERROR: varnishevent/varnishncsa backend and client logs differ"
exit
1
fi
diffem
"varnishevent/varnishncsa backend and client logs"
\
$EVENT_LOG
$NCSA_LOG
FORMAT_EVENT
=
'%{VSL:Timestamp[1]}x'
FORMAT_NCSA
=
'%{VSL:Timestamp[2]}x'
...
...
@@ -83,15 +72,8 @@ echo "... VSL formatter"
$EVENT
-r
$INPUT
-F
"
$FORMAT_EVENT
"
>
$EVENT_LOG
$NCSA
-r
$INPUT
-F
"
$FORMAT_NCSA
"
>
$NCSA_LOG
$DIFF_CMD
RC
=
$?
rm
$EVENT_LOG
rm
$NCSA_LOG
if
[
"
$RC
"
-ne
"0"
]
;
then
echo
"ERROR: outputs of varnishevent/varnishncsa VSL formatter differ"
exit
1
fi
diffem
"outputs of varnishevent/varnishncsa VSL formatter"
\
$EVENT_LOG
$NCSA_LOG
FORMAT_EVENT
=
'%{tag:Timestamp[1]}x'
FORMAT_NCSA
=
'%{VSL:Timestamp[2]}x'
...
...
@@ -100,15 +82,8 @@ echo "... compatibility of tag and VSL formatter"
$EVENT
-r
$INPUT
-F
"
$FORMAT_EVENT
"
>
$EVENT_LOG
$NCSA
-r
$INPUT
-F
"
$FORMAT_NCSA
"
>
$NCSA_LOG
$DIFF_CMD
RC
=
$?
rm
$EVENT_LOG
rm
$NCSA_LOG
if
[
"
$RC
"
-ne
"0"
]
;
then
echo
"ERROR: tag and VSL formatters for varnishevent and varnishncsa differ"
exit
1
fi
diffem
"tag and VSL formatters for varnishevent and varnishncsa"
\
$EVENT_LOG
$NCSA_LOG
FORMAT_EVENT
=
'%{vxid}x'
FORMAT_NCSA
=
'%{Varnish:vxid}x'
...
...
@@ -117,14 +92,7 @@ echo "... compatibility of the vxid and Varnish:vxid formatters"
$EVENT
-r
$INPUT
-F
"
$FORMAT_EVENT
"
>
$EVENT_LOG
$NCSA
-r
$INPUT
-F
"
$FORMAT_NCSA
"
>
$NCSA_LOG
$DIFF_CMD
RC
=
$?
rm
$EVENT_LOG
rm
$NCSA_LOG
if
[
"
$RC
"
-ne
"0"
]
;
then
echo
"ERROR: vxid and Varnish:vxid formatters for varnishevent and varnishncsa differ"
exit
1
fi
diffem
"vxid and Varnish:vxid formatters for varnishevent and varnishncsa differ"
\
$EVENT_LOG
$NCSA_LOG
exit
0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment