Add test for timestamp format
valid against following format YYYY-MM-DDThh:mm:ss.sTZD
(e.g.: "1997-07-16T19:20:30.452+01:00")
ref:
@@ -6,6 +6,7 @@ FAILED_TEST_LIST=""
FAILED_TEST_COUNT=0
EVT_FILE="/opt/test-runner/logs/events.log"
+SCOPE_LOG_FILE="/opt/test-runner/logs/scope.log"
starttest(){
CURRENT_TEST=$1
@@ -39,6 +40,7 @@ endtest(){
fi
rm -f $EVT_FILE
+ rm -f $SCOPE_LOG_FILE
}
#
@@ -104,6 +106,22 @@ fi
endtest
+#
+# verify timestamp
+#
+starttest timestamp_verify
+
+SCOPE_LOG_LEVEL=debug ldscope ls >/dev/null
+
+timestamp=$(grep 'Constructor' $SCOPE_LOG_FILE | grep -Po "(?<=\[).*?(?=\])")
+if [[ $timestamp =~ [0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}(Z|\+[0-9]{4})$ ]]; then
+ echo "Timeststamp $timestamp is in expect format"
+else
+ ERR+=1
+fi
+
+endtest
+
if (( $FAILED_TEST_COUNT == 0 )); then
echo ""
echo ""
