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

4.x - Fix snapshot migration tests. #648

Merged
merged 1 commit into from
Oct 13, 2023
Merged

Conversation

ndm2
Copy link
Contributor

@ndm2 ndm2 commented Oct 12, 2023

Hopefully this time for real. While it looked like the tests were working, testMigrateSnapshots() was actually only checking the very first snapshot file over and over again, as subsequent calls to migrate() will not re-read the migration files from disk, but use cached instances from the first call, and that call would only find the very first snapshot file in the list.

The test now checks one file at a time instead of multiple ones, this is slower, but more reliable, and it makes it easier to figure which snapshot failed. Furthermore the snapshots are applied with the same feature flag config as they were created.

Other tests were changed to use a table with no foreign keys, as otherwise it would require altering a bunch of related tables, dropping and recreating foreign keys, the snapshots would be huge, making it easier for mistakes to slip through etc, when all we want to see is the auto-id behavior.

Only the first snapshot was being tested, as subsequent calls to
`migrate()` will not re-read the migration files from disk, but use
cached instances from the first call.
@ndm2 ndm2 force-pushed the 4.x-fix-snapshot-tests branch from 220e899 to a737b70 Compare October 12, 2023 15:52
@markstory markstory merged commit 6e02c42 into 4.x Oct 13, 2023
10 checks passed
@markstory markstory deleted the 4.x-fix-snapshot-tests branch October 13, 2023 02:47
@markstory markstory added this to the 4.x (CakePHP 5) milestone Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants