GHA DB tests fail if you modify the migration after creation in the same PR #5690
Description
I'm submitting a ...
- bug report
Traffic Control components affected ...
- CI tests
Current behavior:
If a migration is edited in the same PR that creates it, the CI action for the database migrations will report that it is out of order, even when it isn't.
Expected behavior:
The tests should account for the possibility that a migration may be edited before being merged, and test accordingly.
Minimal reproduction of the problem with instructions:
My PR #5678 displays this behavior. This is because - I think - the test script assumes that git --no-pager log --format=%ct 2021032600000000_dsrs_originals.sql
is going to output one line, the time of creation of the migration. It then adds this to an array, and later compares it against the latest modification time of any migration using git log -1 --name-status --format="%ct" . | head -n 1
with !=
. So essentially it's comparing
mtime_array+=( "$(git --no-pager log --format=%ct 2021032600000000_dsrs_originals.sql)" )
mtime_length=${#mtime_array[@]}
echo ${mtime_array[$mtime_length-1]}
# Outputs: 1617049981 1616777950
to
git log -1 --name-status --format="%ct" . | head -n 1
# Outputs: 1617049981
Which you can see is lining up with part of the mtime_array
entry, but will never be exactly equal because the entry has two numbers.