Skip to content

Move config/validation tests to migration_test.go, delete runner_test.go (#716 subtasks 7+9)#731

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

Move config/validation tests to migration_test.go, delete runner_test.go (#716 subtasks 7+9)#731
morgo merged 1 commit into
block:mainfrom
morgo:extract-config-tests

Conversation

@morgo
Copy link
Copy Markdown
Collaborator

@morgo morgo commented Apr 30, 2026

Summary

Move the 5 remaining tests from runner_test.go into migration_test.go and delete runner_test.go.

These tests all validate the Migration struct's configuration, DSN construction, and error handling — they belong with the other Migration config tests in migration_test.go.

Tests moved:

  • TestBadOptions — validates required fields
  • TestBadAlter — invalid ALTER statement scenarios (parse errors, MySQL rejections)
  • TestDefaultPort — default port appended when not specified
  • TestPasswordMasking — password masking in DSN strings
  • TestDSN — DSN round-trip with special characters

Also restored stray comments to correct files:

  • Issue Partitioning fails due to SQL syntax error #277 / TestDataFromBadSqlMode comment → e2e_test.go
  • Chunker "boil the ocean" / TestChangeDatatypeLossyNoAutoInc comment → datatype_test.go
  • TestEnumReorder full explanation → datatype_test.go

Conversions:

  • TestBadAlter: table setup → NewTestTable, runner calls → NewTestRunner
  • assertrequire (fail-fast)
  • Table-driven tests use tc instead of tt (avoids shadowing testutils.TestTable)

Impact:

  • runner_test.go: DELETED (323 lines → 0) 🎉
  • migration_test.go: 1,109 → 1,269 lines (+160)

Fixes #724
Fixes #726
Part of #716 (test reorganization)

….go (block#716 subtask 7)

Move 5 remaining tests from runner_test.go into migration_test.go:
- TestBadOptions
- TestBadAlter
- TestDefaultPort
- TestPasswordMasking
- TestDSN

These all test Migration struct validation, DSN construction, and error
handling — they belong with the other Migration config tests.

Conversions:
- TestBadAlter: table setup converted to NewTestTable, runner calls to NewTestRunner
- assert converted to require (fail-fast)
- Table-driven tests use 'tc' instead of 'tt' (avoids shadowing testutils.TestTable)

runner_test.go: DELETED (323 lines -> 0)
migration_test.go: 1109 -> 1269 lines (+160)

Fixes block#724
Part of block#716 (test reorganization)
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 continues the migration test suite reorganization by consolidating configuration/validation tests under migration_test.go and removing the now-redundant runner_test.go, while also relocating several explanatory comments back to the tests they describe.

Changes:

  • Moved 5 config/validation tests from runner_test.go into migration_test.go (with helper-based setup and require assertions).
  • Deleted pkg/migration/runner_test.go after the move.
  • Restored/moved stray explanatory comments to e2e_test.go and datatype_test.go.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
pkg/migration/runner_test.go Deleted after migrating remaining tests out.
pkg/migration/migration_test.go Added the migrated config/validation tests and necessary import.
pkg/migration/e2e_test.go Moved Issue #277 context comment to the relevant test.
pkg/migration/datatype_test.go Restored expanded explanatory comments for chunker/ENUM reorder tests.

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

@morgo morgo merged commit 8b37ac7 into block:main Apr 30, 2026
16 checks passed
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.

9. Delete runner_test.go 7. Move config/validation tests into migration_test.go

3 participants