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

Make another example for Rules release to a non-default Firestore db #12263

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

Conversation

rainshen49
Copy link
Contributor

Fixes hashicorp/terraform-provider-google#16324
Fixes hashicorp/terraform-provider-google#15838

Deploying rules to non-default Firestore instances already works. Adding examples to guide users better.

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.

Copy link

github-actions bot commented Nov 6, 2024

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

@melinath, 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 ( 2 files changed, 72 insertions(+), 17 deletions(-))
google-beta provider: Diff ( 2 files changed, 72 insertions(+), 17 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 5
Passed tests: 3
Skipped tests: 0
Affected tests: 2

Click here to see the affected service packages
  • firebaserules

Action taken

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

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

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

🟢 No issues found for passed tests after REPLAYING rerun.


🔴 Tests failed during RECORDING mode:
TestAccFirebaserulesRelease_FirestoreReleaseHandWritten [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

@rainshen49 rainshen49 marked this pull request as draft November 6, 2024 19:40
@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 ( 2 files changed, 84 insertions(+), 17 deletions(-))
google-beta provider: Diff ( 2 files changed, 84 insertions(+), 17 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 5
Passed tests: 4
Skipped tests: 0
Affected tests: 1

Click here to see the affected service packages
  • firebaserules

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
  • TestAccFirebaserulesRelease_FirestoreReleaseHandWritten

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccFirebaserulesRelease_FirestoreReleaseHandWritten [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

@rainshen49 rainshen49 marked this pull request as ready for review November 6, 2024 20:10
Copy link

@melinath This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

@@ -1,22 +1,22 @@
# In case there are existing rules in the default db
import {
id = "projects/{{project}}/releases/cloud.firestore"
Copy link
Member

Choose a reason for hiding this comment

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

I see that the tests failed before adding this import. Just wanted to check in to make sure this is safe to merge. Specifically: Is this test relying on global state / will it potentially break other tests?

The failure case would be: This release is created by another test (or is present by default and expected to exist by another test) and is getting deleted every time this test runs.

Copy link
Member

Choose a reason for hiding this comment

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

(Just to be clear, I'm not saying this shouldn't be here, just want to make sure I understand why it's here & that it won't have unintended side effects on other tests)

Copy link
Contributor Author

@rainshen49 rainshen49 Nov 12, 2024

Choose a reason for hiding this comment

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

  1. Yes, it relies on the default Firestore instance being present and having rules already.
  2. It's unlikely to break other tests because no other tests depend on the rules.

I'm trying to figure out what the rules state is in the test project, why it has rules already, and whether it is due to a previous run of the same test or something else.

Copy link
Contributor Author

@rainshen49 rainshen49 Nov 12, 2024

Choose a reason for hiding this comment

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

I discovered the Google Cloud Console UI automatically deploys default rules if none present, and there's no way to delete that other than via the API. So, if anybody visits the UI for Firestore > Security Rules, the tests are now broken unless an import block is present. How can I clean this up for all the test projects? Or perhaps it's the less painful of the two to keep the import block.

@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 ( 2 files changed, 72 insertions(+), 17 deletions(-))
google-beta provider: Diff ( 2 files changed, 72 insertions(+), 17 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 5
Passed tests: 4
Skipped tests: 0
Affected tests: 1

Click here to see the affected service packages
  • firebaserules

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
  • TestAccFirebaserulesRelease_FirestoreReleaseHandWritten

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🔴 Tests failed during RECORDING mode:
TestAccFirebaserulesRelease_FirestoreReleaseHandWritten [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

@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 ( 2 files changed, 72 insertions(+), 5 deletions(-))
google-beta provider: Diff ( 2 files changed, 72 insertions(+), 5 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 5
Passed tests: 4
Skipped tests: 0
Affected tests: 1

Click here to see the affected service packages
  • firebaserules

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
  • TestAccFirebaserulesRelease_FirestoreReleaseHandWritten

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🔴 Tests failed during RECORDING mode:
TestAccFirebaserulesRelease_FirestoreReleaseHandWritten [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

@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 ( 2 files changed, 84 insertions(+), 17 deletions(-))
google-beta provider: Diff ( 2 files changed, 84 insertions(+), 17 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 5
Passed tests: 5
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages
  • firebaserules

🟢 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
3 participants