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

ICD: Promote read replicas #5738

Merged
merged 10 commits into from
Nov 12, 2024
Merged

Conversation

lornakelly
Copy link
Contributor

@lornakelly lornakelly commented Oct 22, 2024

  • Allow promotion of read replicas for postgresql, mysql and enterprisedb instances

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Relates OR Closes https://github.ibm.com/compose/App/issues/1352

Output from acceptance testing:

=== RUN   TestAccIBMDatabaseInstancePostgresReadReplicaPromotion
=== PAUSE TestAccIBMDatabaseInstancePostgresReadReplicaPromotion
=== CONT  TestAccIBMDatabaseInstancePostgresReadReplicaPromotion
--- PASS: TestAccIBMDatabaseInstancePostgresReadReplicaPromotion (1174.03s)
PASS
ok      github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/database        1177.472s

=== RUN   TestAccIBMDatabaseInstanceMySQLReadReplicaPromotion
=== PAUSE TestAccIBMDatabaseInstanceMySQLReadReplicaPromotion
=== CONT  TestAccIBMDatabaseInstanceMySQLReadReplicaPromotion
--- PASS: TestAccIBMDatabaseInstanceMySQLReadReplicaPromotion (498.19s)
PASS
ok      github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/database        501.844s

=== RUN   TestAccIBMDatabaseInstanceEDBReadReplicaPromotion
=== PAUSE TestAccIBMDatabaseInstanceEDBReadReplicaPromotion
=== CONT  TestAccIBMDatabaseInstanceEDBReadReplicaPromotion
--- PASS: TestAccIBMDatabaseInstanceEDBReadReplicaPromotion (1993.78s)
PASS
ok      github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/database        1996.886s

...

location = "%[3]s"
service_endpoints = "public-and-private"
remote_leader_id = "%[4]s"
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rather than duplicating the minimal configuration, you can compose the two configs,
testAccCheckIBMDatabaseInstanceMySQLMinimal and testAccCheckIBMDatabaseInstanceMySQLMinimal_ReadReplica

See MongDB Enterprise https://github.com/IBM-Cloud/terraform-provider-ibm/blob/master/ibm/service/database/resource_ibm_database_mongodb_enterprise_test.go#L160-L162

Copy link
Contributor Author

@lornakelly lornakelly Nov 5, 2024

Choose a reason for hiding this comment

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

@alexhemard have been working on this for a while and cant seem to find out why combining the above is breaking the tests. These are the changes but just looks at the resource_ibm_database_postgresql_test.go test file as that is what I am trying to get working first
0ab9de7

From what I can tell, the destroy function seems to get executed before the promote step (step 2) so the promote never happens and then we get an expected error that you cant delete leader that has replica. I have read up and that the destroy function should execute after the final step but that doesnt seem to be the case - any ideas?

FYI In the mongo example, there is no step after the combined one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alexhemard Pushed updates to tests based on convo yesterday. One change is the sourceInstanceCRN doesnt actually get set in the test func - so cant pass it as a param in read replica step so I did the same as the mongo which is reference it directly.

I think an enhancement to the Exists function is to return the crn as well so we can use it but probably out of scope for this ticket. Let me know if you want me to change it

Copy link
Collaborator

@alexhemard alexhemard left a comment

Choose a reason for hiding this comment

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

LGTM

@alexhemard alexhemard merged commit 83ec24d into IBM-Cloud:master Nov 12, 2024
1 check 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.

2 participants