Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHA DB tests fail if you modify the migration after creation in the same PR #5690

Closed
ocket8888 opened this issue Mar 29, 2021 · 1 comment · Fixed by #5723
Closed

GHA DB tests fail if you modify the migration after creation in the same PR #5690

ocket8888 opened this issue Mar 29, 2021 · 1 comment · Fixed by #5723
Assignees
Labels
automation related to automated testing/deployment/packaging etc. bug something isn't working as intended tests related to tests and/or testing infrastructure

Comments

@ocket8888
Copy link
Contributor

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.

@ocket8888 ocket8888 added bug something isn't working as intended tests related to tests and/or testing infrastructure automation related to automated testing/deployment/packaging etc. labels Mar 29, 2021
@rimashah25
Copy link
Contributor

I can take this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation related to automated testing/deployment/packaging etc. bug something isn't working as intended tests related to tests and/or testing infrastructure
Projects
None yet
2 participants