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

artifactregistry: accept all valid durations #12667

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Subserial
Copy link
Contributor

Fixes hashicorp/terraform-provider-google#20796

Release Note Template for Downstream PRs (will be copied)

artifactregistry: fix `artifact_registry_repository` not accepting durations with 'm', 'h' or 'd'

@github-actions github-actions bot requested a review from SirGitsalot December 30, 2024 22:01
Copy link

Hello! I am a robot. Tests will require approval from a repository maintainer to run.

@SirGitsalot, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 3 files changed, 24 insertions(+), 4 deletions(-))
google-beta provider: Diff ( 3 files changed, 24 insertions(+), 4 deletions(-))
Open in Cloud Shell: Diff ( 1 file changed, 1 insertion(+), 1 deletion(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 30
Passed tests: 28
Skipped tests: 1
Affected tests: 1

Click here to see the affected service packages
  • artifactregistry

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccArtifactRegistryRepository_artifactRegistryRepositoryCleanupExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🔴 Tests failed during RECORDING mode:
TestAccArtifactRegistryRepository_artifactRegistryRepositoryCleanupExample [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@Subserial Subserial marked this pull request as draft December 31, 2024 00:52
@SirGitsalot
Copy link
Member

I think you're looking for a custom expander rather than a custom flattener (that is, a function the converts a TF request to an API request) rather than a flattener (which converts an API response to its TF equivalent). The API types that field as a google.protobuf.Duration which must be encoded in seconds in JSON requests.

@Subserial
Copy link
Contributor Author

It's actually more annoying than that: since the field is in a map, the object gets hashed before I read the value, meaning I can't correlate the objects to be compared. I'm moving upwards and writing a diff suppress function on the map itself.

@Subserial
Copy link
Contributor Author

The cleaner solution was to use the id field as a hash key. I wonder why this isn't the default behavior for maps.

@Subserial Subserial marked this pull request as ready for review January 9, 2025 19:41
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 3 files changed, 122 insertions(+), 12 deletions(-))
google-beta provider: Diff ( 3 files changed, 122 insertions(+), 12 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 113 insertions(+), 2 deletions(-))
Open in Cloud Shell: Diff ( 1 file changed, 1 insertion(+), 1 deletion(-))

Breaking Change(s) Detected

The following breaking change(s) were detected within your pull request.

  • Field cleanup_policies.condition.newer_than lost its diff suppress function - reference
  • Field cleanup_policies.condition.older_than lost its diff suppress function - reference

If you believe this detection to be incorrect please raise the concern with your reviewer.
If you intend to make this change you will need to wait for a major release window.
An override-breaking-change label can be added to allow merging.

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_artifact_registry_repository (35 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_artifact_registry_repository" "primary" {
  cleanup_policies {
    condition {
      newer_than = # value needed
    }
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 30
Passed tests: 29
Skipped tests: 1
Affected tests: 0

Click here to see the affected service packages
  • artifactregistry

🟢 All tests passed!

View the build log

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 3 files changed, 148 insertions(+), 6 deletions(-))
google-beta provider: Diff ( 3 files changed, 148 insertions(+), 6 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 113 insertions(+), 2 deletions(-))
Open in Cloud Shell: Diff ( 1 file changed, 16 insertions(+), 1 deletion(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 30
Passed tests: 28
Skipped tests: 1
Affected tests: 1

Click here to see the affected service packages
  • artifactregistry

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccArtifactRegistryRepository_artifactRegistryRepositoryCleanupExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccArtifactRegistryRepository_artifactRegistryRepositoryCleanupExample [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🟢 All tests passed!

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 3 files changed, 146 insertions(+), 6 deletions(-))
google-beta provider: Diff ( 3 files changed, 146 insertions(+), 6 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 111 insertions(+), 2 deletions(-))
Open in Cloud Shell: Diff ( 1 file changed, 16 insertions(+), 1 deletion(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 30
Passed tests: 29
Skipped tests: 1
Affected tests: 0

Click here to see the affected service packages
  • artifactregistry

🟢 All tests passed!

View the build log

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.

google_artifact_registry_repository cleanup_policies doesn't work with non-second unit durations
3 participants