Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishevent3
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
varnishevent3
Commits
24472cf7
Commit
24472cf7
authored
Oct 12, 2013
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
varnishevent: more testing against the output of varnishncsa
parent
d242c32c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
12 deletions
+45
-12
ncsa.sh
bin/varnishevent/test/ncsa.sh
+45
-12
varnish.binlog
bin/varnishevent/test/varnish.binlog
+0
-0
No files found.
bin/varnishevent/test/ncsa.sh
View file @
24472cf7
...
...
@@ -3,31 +3,64 @@
# 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 '-'.
#
# Unfortunately an exact comparison cannot be made, because
# varnishncsa seems to have some errors (URL entries apparently not
# always cleanly cleared). So we check that the nummber of diff hunks
# is not greater than a threshold.
echo
echo
"TEST:
$0
"
echo
"... testing (near) equivalence of output with varnishncsa"
TMP
=
${
TMPDIR
:-
/tmp
}
EVENT
=
"../varnishevent"
NCSA
=
"../../varnishncsa/varnishncsa"
EVENT_
CKSUM
=
$(
$EVENT
-r
varnish.binlog |
sed
's/-//g'
|
cksum
)
NCSA_
CKSUM
=
$(
$NCSA
-r
varnish.binlog |
sed
's/-//g'
|
cksum
)
EVENT_
LOG
=
$TMP
/event.log
NCSA_
LOG
=
$TMP
/ncsa.log
if
[
"
$EVENT_CKSUM
"
!=
"
$NCSA_CKSUM
"
]
;
then
echo
"ERROR: cksums of no-arg varnishevent and varnishncsa differ"
echo
"varnishevent cksum =
$EVENT_CKSUM
"
echo
"varnishncsa cksum =
$NCSA_CKSUM
"
DIFF_CMD
=
"diff -U 0
$EVENT_LOG
$NCSA_LOG
"
HUNK_THRESH
=
1
$EVENT
-r
varnish.binlog |
sed
's/-//g'
>
$EVENT_LOG
$NCSA
-r
varnish.binlog |
sed
's/-//g'
>
$NCSA_LOG
HUNKS
=
$(
$DIFF_CMD
|
grep
^@ |
wc
-l
)
rm
$EVENT_LOG
rm
$NCSA_LOG
if
[
"
$HUNKS
"
-gt
"
$HUNK_THRESH
"
]
;
then
echo
"ERROR: outputs of no-arg varnishevent and varnishncsa differ"
echo
"
$HUNKS
diff hunks"
exit
1
fi
$EVENT
-r
varnish.binlog
-f
|
sed
's/-//g'
>
$EVENT_LOG
$NCSA
-r
varnish.binlog
-f
|
sed
's/-//g'
>
$NCSA_LOG
HUNKS
=
$(
$DIFF_CMD
|
grep
^@ |
wc
-l
)
rm
$EVENT_LOG
rm
$NCSA_LOG
if
[
"
$HUNKS
"
-gt
"
$HUNK_THRESH
"
]
;
then
echo
"ERROR: outputs of varnishevent/varnishncsa -f differ"
echo
"
$HUNKS
diff hunks"
exit
1
fi
EVENT_CKSUM
=
$(
$EVENT
-r
varnish.binlog
-f
|
sed
's/-//g'
|
cksum
)
NCSA_CKSUM
=
$(
$NCSA
-r
varnish.binlog
-f
|
sed
's/-//g'
|
cksum
)
FORMAT
=
"%b %H %h %{Host}i %{User-Agent}i %{Accept-Ranges}o %{Age}o %{Connection}o %{Content-Length}o %{Content-Type}o %{Date}o %{ETag}o %{Last-Modified}o %{Server}o %{Transfer-Encoding}o %{Vary}o %{Via}o %{X-Varnish}o %l %m %q %r %s %t %{%F-%T}t %U %u %{Varnish:time_firstbyte}x %{Varnish:hitmiss}x %{Varnish:handling}x %{VCL_Log:xid}x"
$EVENT
-r
varnish.binlog
-F
$FORMAT
|
sed
's/-//g'
>
$EVENT_LOG
$NCSA
-r
varnish.binlog
-F
$FORMAT
|
sed
's/-//g'
>
$NCSA_LOG
HUNKS
=
$(
$DIFF_CMD
|
grep
^@ |
wc
-l
)
rm
$EVENT_LOG
rm
$NCSA_LOG
if
[
"
$EVENT_CKSUM
"
!=
"
$NCSA_CKSUM
"
]
;
then
echo
"ERROR: cksums of no-arg varnishevent/varnishncsa -f differ"
echo
"varnishevent cksum =
$EVENT_CKSUM
"
echo
"varnishncsa cksum =
$NCSA_CKSUM
"
if
[
"
$HUNKS
"
-gt
"
$HUNK_THRESH
"
]
;
then
echo
"ERROR: outputs of varnishevent/varnishncsa -F differ"
echo
"
$HUNKS
diff hunks"
exit
1
fi
...
...
bin/varnishevent/test/varnish.binlog
View file @
24472cf7
No preview for this file type
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