Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@timvaillancourt
Copy link
Collaborator

@timvaillancourt timvaillancourt commented Aug 23, 2022

Description

This PR adds basic tests to a few funcs from go/logic/migrator.go

Also some logic in migrator.printStatus() was moved to smaller funcs for testing, such as:

  • migrator.getProgressPercent(rowsEstimated int64) (progressPct float64)
  • migrator.getMigrationETA(rowsEstimated int64) (eta string, etaDuration time.Duration)
  • migrator.getMigrationStateAndETA(rowsEstimated int64) (state, eta string, etaDuration time.Duration)
  • migrator.shouldPrintStatus(rule PrintStatusRule, elapsedSeconds int64, etaDuration time.Duration) (shouldPrint bool)
  • migrator.shouldPrintMigrationStatus(rule PrintStatusRule, elapsedSeconds int64) (shouldPrint bool)

The logic that moved to funcs should be unchanged

Lastly, the migrator.validateStatement() func was renamed to migrator.validateAlterStatement() for clarity

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.

@timvaillancourt timvaillancourt added this to the v1.1.6 milestone Aug 23, 2022
@timvaillancourt timvaillancourt merged commit 1df37c2 into github:master Sep 6, 2022
@timvaillancourt timvaillancourt deleted the logic-migrator-tests branch September 6, 2022 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant