Skip to content

test(db): cover migration version sorting - #63536

Open
joshtrichards wants to merge 4 commits into
masterfrom
jtr/test-fix-db-migration-version-handling
Open

test(db): cover migration version sorting#63536
joshtrichards wants to merge 4 commits into
masterfrom
jtr/test-fix-db-migration-version-handling

Conversation

@joshtrichards

Copy link
Copy Markdown
Member
  • Resolves: #

Summary

The timestamp-only values in today’s tests are remnants from the initial test scaffolding from PR #5231. The formatting in the production code was changed before being merged to consist of version+timestamp, but tests still had the old approach.

Main issue is that only the defensive fallback in MigrationService::sortMigrations() rather than the production sort path.

Changes:

  • Replace never-actually-used-in-production timestamp-only migration fixtures with realistic <version>Date<timestamp> identifiers.
  • Use deliberately unordered fixtures to verify numeric version ordering and date ordering within the same version.
  • Verify that migration aliases and execution order use the same ordering.
  • Add DB-backed coverage for sorting versions returned from the migrations table (existing tests don't cover this since they mock getMigratedVersions())

Historical context: #5231 and #47515.

TODO

  • Backport to at least v33

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@joshtrichards joshtrichards added this to the Nextcloud 35 milestone Aug 24, 2026
@joshtrichards
joshtrichards requested a review from a team as a code owner August 24, 2026 13:15
@joshtrichards
joshtrichards requested review from icewind1991, leftybournes, provokateurin and sorbaugh and removed request for a team August 24, 2026 13:15
@joshtrichards joshtrichards added 2. developing Work in progress feature: install and update tests Related to tests feature: database Database related DB labels Aug 24, 2026
Signed-off-by: Josh <josh.t.richards@gmail.com>
A follow-up to #47515 that exercises getMigratedVersions() for regressions for real, since the existing tests mock it and don't test it.

Assisted-by: Copilot:gpt-5.6-sol

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards
joshtrichards force-pushed the jtr/test-fix-db-migration-version-handling branch from edcf452 to c4629f6 Compare August 24, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants