-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Bigtable: Compare column family #6422
Bigtable: Compare column family #6422
Conversation
Oops! It looks like no changelog entry is attached to this PR. Please include a release note block in the PR body, as described in https://github.com/GoogleCloudPlatform/magic-modules/blob/master/.ci/RELEASE_NOTES_GUIDE.md:
|
Hello! I am a robot who works on Magic Modules PRs. I've detected that you're a community contributor. @melinath, a repository maintainer, has been assigned to assist you and help review your changes. ❓ First time contributing? Click here for more detailsYour assigned reviewer will help review your code by:
You can help make sure that review is quick by running local tests and ensuring they're passing in between each push you make to your PR's branch. Also, try to leave a comment with each push you make, as pushes generally don't generate emails. If your reviewer doesn't get back to you within a week after your most recent change, please feel free to leave a comment on the issue asking them to take a look! In the absence of a dedicated review dashboard most maintainers manage their pending reviews through email, and those will sometimes get lost in their inbox. |
@hoangpham95 , please take a look. |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 1 file changed, 2 insertions(+), 1 deletion(-)) |
Tests analyticsTotal tests: Action takenTriggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed testsTestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample|TestAccComputeInstance_soleTenantNodeAffinities|TestAccComputeInstance_networkPerformanceConfig|TestAccComputeGlobalForwardingRule_internalLoadBalancing|TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample|TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample|TestAccCloudFunctions2Function_fullUpdate|TestAccCloudRunService_cloudRunServiceStaticOutboundExample |
Tests passed during RECORDING mode: Tests failed during RECORDING mode: Please fix these to complete your PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update your release note according to the release note authoring guide.
It looks like we have integration tests for this resource which failed to catch this bug. Please update them so that we'll be able to catch any future regressions.
I think that adding an ImportState / ImportStateVerify section should be sufficient - since that would automatically check whether the end state matches what's expected - but there's probably a reason those weren't put in place originally.
Alternately, you could modify the existing Check func to be able to verify the value of - I guess of the resource id?
What is the current observed behavior? Is there a bug or feature request that this PR is related to?
Docs on writing tests:
Yes, the tracking bug is b/230626815. Basically the read and diffing parts are broken. For this PR, I the only different is the Id is set after the read: d.SetId(fi.GCPolicy). There are other PRs are coming. Let me check if I can verify the Id field. |
I am not certain why ImportState: true, ImportStateVerify: true, are not there and instead we only have some composite check functions. |
Also, there seems to be doing two reads: c.TableInfo(ctx, tableName)
Seems to be wrong/redundant. |
Ok, I added the following test case:
The test failed with this error:
I don't understand why GC policy doesn't support import. Maybe we can deal with it separately. |
Oops! It looks like no changelog entry is attached to this PR. Please include a release note block in the PR body, as described in https://github.com/GoogleCloudPlatform/magic-modules/blob/master/.ci/RELEASE_NOTES_GUIDE.md:
|
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 2 files changed, 3 insertions(+), 2 deletions(-)) |
GC policy is not importable for some reason. |
Tests analyticsTotal tests: Action takenTriggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed testsTestAccSqlDatabaseInstance_SqlServerAuditConfig|TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRange|TestAccFirebaserulesRelease_BasicRelease|TestAccComputeInstance_networkPerformanceConfig|TestAccComputeInstance_soleTenantNodeAffinities|TestAccComputeGlobalForwardingRule_internalLoadBalancing|TestAccCloudFunctions2Function_fullUpdate|TestAccCloudRunService_cloudRunServiceStaticOutboundExample|TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample|TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample|TestAccSqlDatabaseInstance_PointInTimeRecoveryEnabled|TestAccSqlDatabaseInstance_settings_upgrade|TestAccSqlDatabaseInstance_authNets|TestAccSqlDatabaseInstance_basicMSSQL|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample|TestAccSqlDatabaseInstance_settings_deletionProtection|TestAccSqlDatabaseInstance_basic_with_user_labels |
Tests passed during RECORDING mode: Tests failed during RECORDING mode: Please fix these to complete your PR |
Regarding why import isn't implemented yet - I found details here: hashicorp/terraform-provider-google#4962 (comment) if you want to implement import, that would make it easy to automate verifying field values with ImportState and ImportStateVerify - but it doesn't need to be a blocker for this PR. You can add a specific check for the appropriate field value instead. |
That makes sense. The nested GC policy (rules) support is being worked on. The current issue is tracked in b/230626815. We will likely go with checking the remote GC policy against the local copy in the test first. Later will properly implement import for GC policy (b/243127709). We are still waiting for PR(s) to properly check the nest GC policy. For now, I added a check to make sure that
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update your release note according to the release note authoring guide.
@@ -406,7 +406,7 @@ func testAccBigtableGCPolicyExists(t *testing.T, n string) resource.TestCheckFun | |||
} | |||
|
|||
for _, i := range table.FamilyInfos { | |||
if i.Name == rs.Primary.Attributes["column_family"] { | |||
if i.Name == rs.Primary.Attributes["column_family"] && rs.Primary.ID != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this change does anything - if rs.Primary.ID == ""
this func returns an error - so we already know that rs.Primary.ID != ""
if we've gotten here.
Since this change is to make d.SetId(fi.GCPolicy)
get called in a specific case, could we instead use something like one of the builtin check functions to check the exact value of the id field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will check the value of Primary.ID. It won't be very useful once we set the nested GC policy in JSON format in "gc_rules".
I am going to check the value in the same function instead of using a built-in function.
Done.
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 2 files changed, 3 insertions(+), 2 deletions(-)) |
Tests analyticsTotal tests: Action takenTriggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed testsTestAccFirebaserulesRelease_BasicRelease|TestAccComputeInstance_soleTenantNodeAffinities|TestAccComputeInstance_networkPerformanceConfig|TestAccComputeGlobalForwardingRule_internalLoadBalancing|TestAccCloudFunctions2Function_fullUpdate|TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample|TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample|TestAccCloudRunService_cloudRunServiceStaticOutboundExample|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample|TestAccSqlDatabaseInstance_SqlServerAuditConfig|TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRange |
Tests passed during RECORDING mode: Tests failed during RECORDING mode: Please fix these to complete your PR |
Running tests manually out of paranoia: https://ci-oss.hashicorp.engineering/buildConfiguration/GoogleCloudBeta_ProviderGoogleCloudBetaMmUpstream/328778 should be fine as long as that passes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the TestAccBigtableGCPolicy_multiplePolicies test is currently failing (and it is a real failure. I can also reproduce it manually.) This wasn't caught by the VCR tests because it skips VCR testing.
The error is:
Error retrieving gc policy. Could not find policy in family tf-test-co80ek8ebh
I think this error message should probably be expanded to also include the value of rs.Primary.ID
, which would probably shed light on why it's now failing.
If possible, please run this test manually locally to make sure your fix works before pushing it :-)
Thanks! Let me take a look and get back to you. |
Well, TestAccBigtableGCPolicy_multiplePolicies is not valid. We can't apply multiple polices to the same column family. Let me think about what to do with that test case. |
I updated the test case to have multiple GC policy, but one per column family. |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 2 files changed, 15 insertions(+), 7 deletions(-)) |
Tests analyticsTotal tests: Action takenTriggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed testsTestAccComputeInstance_soleTenantNodeAffinities|TestAccComputeInstance_networkPerformanceConfig|TestAccCloudFunctions2Function_fullUpdate|TestAccComputeGlobalForwardingRule_internalLoadBalancing|TestAccCloudRunService_cloudRunServiceScheduledExample|TestAccCloudRunService_cloudRunServiceStaticOutboundExample|TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample|TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample|TestAccCGCSnippet_eventarcWorkflowsExample|TestAccCGCSnippet_storageObjectLifecycleSettingExample|TestAccSqlDatabaseInstance_SqlServerAuditConfig|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample|TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRange |
Tests passed during RECORDING mode: Tests failed during RECORDING mode: Please fix these to complete your PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Compare column family when reading a GC policy * revert column family change * Compare column family when reading a GC policy * Check rs.Primary.ID is not empty * Compare Primary.Id with GCPolicy * One GC policy per column family
Fix comparing the wrong name when reading a GC policy.
If this PR is for Terraform, I acknowledge that I have:
make test
andmake lint
to ensure it passes unit and linter tests.Release Note Template for Downstream PRs (will be copied)