Commit 79811875 authored by Geoff Simmons's avatar Geoff Simmons

make the regression tests independent of local time zone in which they are run

parent add7c855
Pipeline #100 skipped
...@@ -372,6 +372,10 @@ reproduces the same value that was present in the log, while ...@@ -372,6 +372,10 @@ reproduces the same value that was present in the log, while
varnishncsa performs floating point conversions, with some loss of varnishncsa performs floating point conversions, with some loss of
precision. precision.
The date/time formatters ``%t`` and ``%{X}t`` assume the local time
zone, as set in varnishevent's environment. You can control the output
by setting the ``TZ`` environment variable.
REQUIREMENTS REQUIREMENTS
============ ============
......
...@@ -4,6 +4,10 @@ echo ...@@ -4,6 +4,10 @@ echo
echo "TEST: $0" echo "TEST: $0"
echo '... testing output and log against known checksums' echo '... testing output and log against known checksums'
# Ensure that the local time date formatters produce the same output
# wherever the test is run.
export TZ=UTC
LOG=test.log LOG=test.log
OUT=output.log OUT=output.log
...@@ -12,7 +16,7 @@ rm -f $LOG $OUT ...@@ -12,7 +16,7 @@ rm -f $LOG $OUT
../varnishevent -f varnishevent.conf -r varnish-4.1.0-doc.log -w $OUT -v ../varnishevent -f varnishevent.conf -r varnish-4.1.0-doc.log -w $OUT -v
CKSUM=$( cksum $OUT ) CKSUM=$( cksum $OUT )
if [ "$CKSUM" != "1046111307 442153 $OUT" ]; then if [ "$CKSUM" != "54743924 442153 $OUT" ]; then
echo "ERROR: Regression test log output incorrect cksum: $CKSUM" echo "ERROR: Regression test log output incorrect cksum: $CKSUM"
exit 1 exit 1
fi fi
......
...@@ -8,10 +8,14 @@ IN=varnish-4.1.0-doc.log ...@@ -8,10 +8,14 @@ IN=varnish-4.1.0-doc.log
CONF=varnishevent.conf CONF=varnishevent.conf
LOG=/dev/null LOG=/dev/null
# Ensure that the local time date formatters produce the same output
# wherever the test is run.
export TZ=UTC
echo "... no VSL args" echo "... no VSL args"
CKSUM=$( ../varnishevent -r ${IN} -f ${CONF} -l ${LOG} | cksum) CKSUM=$( ../varnishevent -r ${IN} -f ${CONF} -l ${LOG} | cksum)
if [ "$CKSUM" != '2861633151 442191' ]; then if [ "$CKSUM" != '2542287168 442191' ]; then
echo "ERROR: no VSL args unexpected cksum: $CKSUM" echo "ERROR: no VSL args unexpected cksum: $CKSUM"
exit 1 exit 1
fi fi
...@@ -20,7 +24,7 @@ echo "... -g vxid" ...@@ -20,7 +24,7 @@ echo "... -g vxid"
CKSUM=$( ../varnishevent -g vxid -r ${IN} -f ${CONF} -l ${LOG} | cksum) CKSUM=$( ../varnishevent -g vxid -r ${IN} -f ${CONF} -l ${LOG} | cksum)
# Same as default (no -g arg) # Same as default (no -g arg)
if [ "$CKSUM" != '2861633151 442191' ]; then if [ "$CKSUM" != '2542287168 442191' ]; then
echo "ERROR: -g vxid unexpected cksum: $CKSUM" echo "ERROR: -g vxid unexpected cksum: $CKSUM"
exit 1 exit 1
fi fi
...@@ -28,7 +32,7 @@ fi ...@@ -28,7 +32,7 @@ fi
echo "... -g request" echo "... -g request"
CKSUM=$( ../varnishevent -g request -r ${IN} -f ${CONF} -l ${LOG} | cksum) CKSUM=$( ../varnishevent -g request -r ${IN} -f ${CONF} -l ${LOG} | cksum)
if [ "$CKSUM" != '519771253 443186' ]; then if [ "$CKSUM" != '3970366484 443186' ]; then
echo "ERROR: -g request unexpected cksum: $CKSUM" echo "ERROR: -g request unexpected cksum: $CKSUM"
exit 1 exit 1
fi fi
...@@ -64,7 +68,7 @@ fi ...@@ -64,7 +68,7 @@ fi
echo "... -q query" echo "... -q query"
CKSUM=$( ../varnishevent -q 'ReqURL ~ "_static"' -r ${IN} -l ${LOG} | cksum) CKSUM=$( ../varnishevent -q 'ReqURL ~ "_static"' -r ${IN} -l ${LOG} | cksum)
if [ "$CKSUM" != '3256944209 830' ]; then if [ "$CKSUM" != '805680033 830' ]; then
echo "ERROR: -q query unexpected cksum: $CKSUM" echo "ERROR: -q query unexpected cksum: $CKSUM"
exit 1 exit 1
fi fi
...@@ -79,7 +83,7 @@ fi ...@@ -79,7 +83,7 @@ fi
echo "... -C" echo "... -C"
CKSUM=$( ../varnishevent -C -q 'ReqURL ~ "_STATIC"' -r ${IN} -l ${LOG} | cksum) CKSUM=$( ../varnishevent -C -q 'ReqURL ~ "_STATIC"' -r ${IN} -l ${LOG} | cksum)
if [ "$CKSUM" != '3256944209 830' ]; then if [ "$CKSUM" != '805680033 830' ]; then
echo "ERROR: -q query unexpected cksum: $CKSUM" echo "ERROR: -q query unexpected cksum: $CKSUM"
exit 1 exit 1
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment