Skip to content

Add copier test, upgrade testcontainers #1567

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

Merged
merged 3 commits into from
Jun 25, 2025
Merged

Conversation

meiji163
Copy link
Contributor

@meiji163 meiji163 commented Jun 25, 2025

Description

This PR adds tests for the copier part of the Migrator. Also upgrade testcontainers to v0.37.0 per #1457 (comment).
The tests are added in migrator_test.go, the rest of the changes are tidying tests and vendoring.

The PR is low risk because the changes only affect tests.

In case this PR introduced Go code changes:

  • contributed code is using same conventions as original code
  • script/cibuild returns with no formatting errors, build errors or unit test errors.

@Copilot Copilot AI review requested due to automatic review settings June 25, 2025 19:02
Copy link

@Copilot 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 adds a new copier integration test for the Migrator component, standardizes and refactors existing tests to use shared test utilities, and upgrades Testcontainers (and other dependencies) to v0.37.0.

  • Introduce getTest* helpers and newTestMigrationContext in test_utils.go
  • Refactor streamer, migrator, and applier tests to use the MySQL module and shared helpers
  • Add TestCopierIntPK to validate the copier logic and bump testcontainers-go to v0.37.0

Reviewed Changes

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

Show a summary per file
File Description
go/logic/test_utils.go Add constants and helper functions for DB/table names and connection contexts
go/logic/streamer_test.go Refactor to use mysql.Run, shared utils, and table helpers
go/logic/migrator_test.go Rename tests, inject newTestMigrationContext, add TestCopierIntPK
go/logic/applier_test.go Refactor to use shared utils for container setup and teardown
go.mod Upgrade github.com/testcontainers/testcontainers-go and related modules to v0.37.0
Comments suppressed due to low confidence (2)

go/logic/migrator_test.go:435

  • The database name in the SHOW TABLES query is still hardcoded to test. Use testMysqlDatabase instead of the literal test to stay consistent with the helper constants.
		default:

go/logic/migrator_test.go:397

  • Using range directly on an int64 (numRows) is invalid in Go and will not compile. Change to an indexed loop, e.g. for i := int64(0); i < numRows; i++ {}.
	for i := range numRows {

@meiji163 meiji163 merged commit 7c40d9e into master Jun 25, 2025
8 of 9 checks passed
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