Skip to content

Extract DDL and cutover lifecycle tests (#716 subtasks 5+6)#730

Merged
morgo merged 1 commit into
block:mainfrom
morgo:extract-ddl-tests
Apr 30, 2026
Merged

Extract DDL and cutover lifecycle tests (#716 subtasks 5+6)#730
morgo merged 1 commit into
block:mainfrom
morgo:extract-ddl-tests

Conversation

@morgo
Copy link
Copy Markdown
Collaborator

@morgo morgo commented Apr 30, 2026

Summary

Move 6 DDL algorithm selection tests into ddl_test.go and 7 cutover lifecycle tests into cutover_test.go, fully converting them to use test helpers.

DDL tests → ddl_test.go (210 lines, new)

  • TestForNonInstantBurn
  • TestIndexVisibility
  • TestStatementWorkflowStillInstant
  • TestTrailingSemicolon
  • TestAlterExtendVarcharE2E
  • TestMigrationWithSQLCommentsInStatement

Cutover lifecycle tests → cutover_test.go (appended 238 lines)

  • TestSkipDropAfterCutoverLongTableName
  • TestForRemainingTableArtifacts
  • TestSkipDropAfterCutover
  • TestDropAfterCutover
  • TestDeferCutOver
  • TestDeferCutOverE2E
  • TestDeferCutOverE2EBinlogAdvance

Conversions applied

  • All table setup → NewTestTable
  • All NewRunnerNewTestRunner/NewTestRunnerFromStatement/NewTestMigration
  • assertrequire (fail-fast)
  • mysql.ParseDSN eliminated from all converted tests
  • Cutover tests use WithSkipDropAfterCutover/WithDeferCutOver/WithRespectSentinel/WithDBName

Impact

  • runner_test.go: 1,052 → 323 lines (-69%)
  • ddl_test.go: 210 lines (new)
  • cutover_test.go: 418 → 656 lines (+238)
  • Only 5 config/validation tests remain in runner_test.go

Fixes #722
Fixes #723
Part of #716

@morgo morgo force-pushed the extract-ddl-tests branch from 43f3a63 to 80953c9 Compare April 30, 2026 17:29
@morgo morgo changed the title Extract DDL tests into ddl_test.go (#716 subtask 5) Extract DDL and cutover lifecycle tests (#716 subtasks 5+6) Apr 30, 2026
@morgo morgo requested a review from Copilot April 30, 2026 17:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reorganizes the migration test suite by extracting DDL algorithm-selection tests into a new ddl_test.go and moving cutover lifecycle tests into cutover_test.go, converting the extracted tests to use shared test helpers to reduce boilerplate and improve maintainability.

Changes:

  • Removed extracted DDL and cutover lifecycle tests from runner_test.go to significantly reduce file size.
  • Added new ddl_test.go containing DDL-focused tests converted to helper-based setup/runners.
  • Appended cutover lifecycle tests to cutover_test.go, also converted to helper-based setup/runners.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
pkg/migration/runner_test.go Removes extracted DDL + cutover lifecycle tests, leaving only config/validation-focused tests.
pkg/migration/ddl_test.go New file containing helper-based DDL algorithm selection and statement parsing tests.
pkg/migration/cutover_test.go Adds helper-based cutover lifecycle tests (skip/drop old table, deferred cutover flows).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/migration/cutover_test.go Outdated
Comment thread pkg/migration/cutover_test.go Outdated
Comment thread pkg/migration/ddl_test.go Outdated
Comment thread pkg/migration/ddl_test.go
Comment thread pkg/migration/ddl_test.go Outdated
Comment thread pkg/migration/cutover_test.go
Move 6 DDL algorithm selection tests into ddl_test.go:
- TestForNonInstantBurn
- TestIndexVisibility
- TestStatementWorkflowStillInstant
- TestTrailingSemicolon
- TestAlterExtendVarcharE2E
- TestMigrationWithSQLCommentsInStatement

Move 7 cutover lifecycle tests into cutover_test.go:
- TestSkipDropAfterCutoverLongTableName
- TestForRemainingTableArtifacts
- TestSkipDropAfterCutover
- TestDropAfterCutover
- TestDeferCutOver
- TestDeferCutOverE2E
- TestDeferCutOverE2EBinlogAdvance

Conversions:
- All table setup converted to NewTestTable
- All NewRunner calls converted to NewTestRunner/NewTestRunnerFromStatement/NewTestMigration
- assert converted to require (fail-fast)
- mysql.ParseDSN eliminated from all converted tests
- Cutover tests use WithSkipDropAfterCutover/WithDeferCutOver/WithRespectSentinel/WithDBName

runner_test.go: 1052 -> 323 lines (-69%)
ddl_test.go: 210 lines (new)
cutover_test.go: 418 -> 656 lines (+238, appended lifecycle tests)

Fixes block#722, fixes block#723
Part of block#716 (test reorganization)
@morgo morgo force-pushed the extract-ddl-tests branch from 80953c9 to e92dc5a Compare April 30, 2026 17:39
@morgo morgo merged commit 79fd855 into block:main Apr 30, 2026
12 checks passed
@morgo morgo deleted the extract-ddl-tests branch April 30, 2026 17:54
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.

6. Move cutover lifecycle tests into cutover_test.go 5. Extract ddl_test.go from runner_test.go

3 participants