fix dates on mac

This commit is contained in:
burnettk 2023-03-10 12:23:42 -05:00
parent d5708f38ca
commit d92bd8d272
No known key found for this signature in database
1 changed files with 9 additions and 2 deletions

View File

@ -37,7 +37,7 @@ if [[ ! -f "$cypress_run_file" ]]; then
echo "success,duration,start_time,end_time,frontend_url" >"$cypress_run_file"
fi
frontend_url="${SPIFFWORKFLOW_FRONTEND_URL:localhost}"
frontend_url="${SPIFFWORKFLOW_FRONTEND_URL:-localhost}"
for attempt in $(seq 1 "$ATTEMPTS" ); do
echo "Running attempt: ${attempt}"
@ -48,7 +48,14 @@ for attempt in $(seq 1 "$ATTEMPTS" ); do
success="true"
fi
end_time=$(date +%s)
if is_mac; then
formatted_start_time=$(date -r "${start_time}" +"%Y-%m-%dT%H-%M-%S")
formatted_end_time=$(date -r "${end_time}" +"%Y-%m-%dT%H-%M-%S")
else
formatted_start_time=$(date "-d@${start_time}" +"%Y-%m-%dT%H-%M-%S")
formatted_end_time=$(date "-d@${end_time}" +"%Y-%m-%dT%H-%M-%S")
fi
echo "${success},$(( end_time - start_time )),$(date "-d@${start_time}"),$(date "-d@${end_time}"),${frontend_url}" >>"$cypress_run_file"
echo "${success},$(( end_time - start_time )),${formatted_start_time},${formatted_end_time},${frontend_url}" >>"$cypress_run_file"
done
echo "Recorded stats to ${cypress_run_file}"