Refactor env, ci, and goose-migrate to accomodate testing. Also add simple tests for up and down command

What does this MR do and why?

Refactored env, ci, and goose-migrate to accomodate testing:

  • Added tests for up and down commands.
  • Added tests for persistent flags.
  • Replaced inits and global variables with the factory pattern to allow instantiation of the migrate command in tests. This allows us to create new fresh states of commands and tests the actual command being run by CLI.
  • Added fixtures that adds dummy tables just for testing.
  • Added feature to skip migrations.

References

This MR closes this issue

How to set up and validate locally

  1. Run env SKIP_MIGRATIONS=true ./env.sh postgres make test-goose-migrate and verify that all tests passes.
  2. Run env SKIP_MIGRATIONS=true ./env.sh spanner make test-goose-migrate and verify that all tests passes.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Tarun Khandelwal

Merge request reports

Loading