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

provider/google: add failover parameter to sql database instance #14336

Merged
merged 2 commits into from
May 22, 2017

Conversation

danawillow
Copy link
Contributor

Fixes #11652.

I wasn't sure the best way to test this, since it looks like the only test involving replica configs so far isn't actually run, and has this comment: Note - this test is not feasible to run unless we generate backups first. (https://github.com/hashicorp/terraform/blob/master/builtin/providers/google/resource_sql_database_instance_test.go#L599)

Copy link
Contributor

@catsby catsby left a comment

Choose a reason for hiding this comment

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

LGTM other than one comment on the test

local = attributes["replica_configuration.0.ca_certificate"]
if instance.ReplicaConfiguration != nil {
server = strconv.FormatBool(instance.ReplicaConfiguration.FailoverTarget)
local = attributes["replica_configuration.0.failover_target"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need any type assertion here to make sure the value returned by attributes["replica_configuration.0.failover_target"] is a bool? make test passes so maybe not. Did the test run at all or are we just going to skip that for now, due to the backups thing you mention?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

attributes is a map[string]string, so we do strconv.FormatBool to get the returned value as a string and then do a string comparison.

There is no test that currently sets this property (the one that looks like it would set replica configuration doesn't actually run, it's just a variable that never gets called)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah my bad, I misread and thought server was a string that was turned into a bool, not the other way around 😄

@danawillow
Copy link
Contributor Author

danawillow commented May 16, 2017

+ @paddycarver as a reviewer for the testing question

local = attributes["replica_configuration.0.ca_certificate"]
if instance.ReplicaConfiguration != nil {
server = strconv.FormatBool(instance.ReplicaConfiguration.FailoverTarget)
local = attributes["replica_configuration.0.failover_target"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah my bad, I misread and thought server was a string that was turned into a bool, not the other way around 😄

@paddycarver
Copy link
Contributor

The code looks good to me. The test question I can't wrap my head around. I'll follow up with you in chat tomorrow, @danawillow, if that's ok?

Copy link
Contributor

@catsby catsby left a comment

Choose a reason for hiding this comment

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

👍 merge at will @danawillow

@danawillow danawillow merged commit 3df5933 into hashicorp:master May 22, 2017
@danawillow danawillow deleted the is-11652 branch May 22, 2017 20:44
@ghost
Copy link

ghost commented Apr 12, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need ability to create Google Cloud SQL 2nd Gen *failover* replica instance
3 participants