Skip to content
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

[feat:] Add --wait Flag to doctl databases migrate Command #1591

Merged
merged 3 commits into from
Oct 15, 2024

Conversation

SkySingh04
Copy link
Contributor

This PR enhances the doctl databases migrate command by adding a --wait flag. The flag allows users to wait for the migration process to complete, simplifying script automation and removing the need for users to implement their own polling mechanisms.

Changes Made

  1. Feature Implementation:

    • Updated the RunDatabaseMigrate function to support the --wait flag.
    • Added logic to poll the /v2/databases/$DATABASE_ID endpoint until the status attribute moves from "migrating" to "online".
    • Display messages (notice) to inform users when the migration is in progress and when it completes.
  2. Unit Tests:

    • Enhanced the TestDatabaseMigrate function to include a test case for the --wait flag.
    • Mocked the Get method to simulate database status polling.
    • Ensured the function correctly handles both success and error cases when the --wait flag is used.

Checklist

  • Implemented the --wait flag for the RunDatabaseMigrate function.
  • Updated the unit tests to cover the --wait flag functionality.
  • Verified that all tests pass and that the new feature works as expected.

Related Issue

Fixes: #1584

@SkySingh04
Copy link
Contributor Author

@loosla Kindly review this PR and let me know if any changes are required

@SkySingh04 SkySingh04 changed the title [feat:] Add --wait Flag to doctl databases migrate Command* [feat:] Add --wait Flag to doctl databases migrate Command Oct 15, 2024
commands/databases_test.go Outdated Show resolved Hide resolved
Co-authored-by: Anna Lushnikova <[email protected]>
Copy link
Contributor

@loosla loosla left a comment

Choose a reason for hiding this comment

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

🚀 Awesome job! Thank you for taking the initiative and completing the task!

@loosla loosla merged commit bbe6124 into digitalocean:main Oct 15, 2024
8 checks passed
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.

Add --wait flag to databases migrate command
2 participants