Output timestamps in yaml to the microsecond if -u is specified.

(cherry picked from commit 3fe7fa3db2)
This commit is contained in:
Mark Andrews
2020-09-29 14:59:40 +10:00
parent ebf16118df
commit a750617445
2 changed files with 48 additions and 4 deletions

View File

@@ -969,6 +969,40 @@ if [ -x "$DIG" ] ; then
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "check that dig without -u displays 'Query time' in millseconds ($n)"
ret=0
dig_with_opts @10.53.0.3 a.example > dig.out.test$n 2>&1 || ret=1
grep ';; Query time: [0-9][0-9]* msec' dig.out.test$n >/dev/null || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "check that dig -u displays 'Query time' in microseconds ($n)"
ret=0
dig_with_opts -u @10.53.0.3 a.example > dig.out.test$n 2>&1 || ret=1
grep ';; Query time: [0-9][0-9]* usec' dig.out.test$n >/dev/null || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "check that dig +yaml without -u displays timestamps in milliseconds ($n)"
ret=0
dig_with_opts +yaml @10.53.0.3 a.example > dig.out.test$n 2>&1 || ret=1
grep 'query_time: !!timestamp ....-..-..T..:..:..\....Z' dig.out.test$n >/dev/null || ret=1
grep 'response_time: !!timestamp ....-..-..T..:..:..\....Z' dig.out.test$n >/dev/null || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1))
echo_i "check that dig -u +yaml displays timestamps in microseconds ($n)"
ret=0
dig_with_opts -u +yaml @10.53.0.3 a.example > dig.out.test$n 2>&1 || ret=1
grep 'query_time: !!timestamp ....-..-..T..:..:..\.......Z' dig.out.test$n >/dev/null || ret=1
grep 'response_time: !!timestamp ....-..-..T..:..:..\.......Z' dig.out.test$n >/dev/null || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
else
echo_i "$DIG is needed, so skipping these dig tests"
fi