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

Fix FirebaseApp sweepers #7279

Merged
merged 3 commits into from
Feb 14, 2023
Merged

Fix FirebaseApp sweepers #7279

merged 3 commits into from
Feb 14, 2023

Conversation

roaks3
Copy link
Contributor

@roaks3 roaks3 commented Feb 13, 2023

These sweepers have been reporting that there are no sweepable resources, but there are resources accumulating and they have hit the limit. This makes a few changes to get the sweeper working as intended:

(One of the API specs for reference https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects.iosApps)

  • Fix the field used from the list response to apps
  • Fix the remove request to use POST
  • Fix the sweeper sweepable field to be displayName instead of name, because name is server-generated
  • Fix the displayNames used for FirebaseApp tests to include sweepable prefixes

If this PR is for Terraform, I acknowledge that I have:

  • Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • Generated Terraform, and ran make test and make lint to ensure it passes unit and linter tests.
  • Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • Ran relevant acceptance tests (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • Read the Release Notes Guide before writing my release note below.

Release Note Template for Downstream PRs (will be copied)


@roaks3 roaks3 requested a review from a team as a code owner February 13, 2023 20:40
@roaks3 roaks3 requested review from trodge and removed request for a team February 13, 2023 20:40
@roaks3
Copy link
Contributor Author

roaks3 commented Feb 13, 2023

Waiting to make sure the generated diffs look correct. Will also try running a sweeper 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.

Terraform GA: Diff ( 3 files changed, 11 insertions(+), 11 deletions(-))
Terraform Beta: Diff ( 14 files changed, 184 insertions(+), 175 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 0
Passed tests 0
Skipped tests: 0
Failed tests: 0

Errors occurred during REPLAYING mode. Please fix them to complete your PR
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.

Terraform GA: Diff ( 3 files changed, 11 insertions(+), 11 deletions(-))
Terraform Beta: Diff ( 14 files changed, 30 insertions(+), 25 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2470
Passed tests 2197
Skipped tests: 256
Failed tests: 17

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccFrameworkProviderMeta_setModuleName|TestAccDataSourceGoogleFirebaseAppleApp|TestAccDataSourceGoogleFirebaseAppleAppConfig|TestAccDataSourceGoogleFirebaseAndroidApp|TestAccFirebaseHostingSite_firebasehostingSiteFullExample|TestAccFirebaseAppleApp_update|TestAccFirebaseAppleApp_firebaseAppleAppFullExample|TestAccFirebaseAppleApp_firebaseAppleAppBasicExample|TestAccFirebaseAndroidApp_update|TestAccFirebaseAndroidApp_firebaseAndroidAppBasicExample|TestAccFirebaseWebApp_firebaseWebAppSkipDelete|TestAccFirebaseHostingSite_firebasehostingSiteUpdate|TestAccFirebaseWebApp_firebaseWebAppFull|TestAccFirebaseWebApp_firebaseWebAppBasicExample|TestAccDataSourceDnsRecordSet_basic|TestAccDataSourceDnsManagedZone_basic|TestAccApigeeAddonsConfig_apigeeAddonsTestExample

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccFrameworkProviderMeta_setModuleName[Debug log]
TestAccFirebaseWebApp_firebaseWebAppBasicExample[Debug log]
TestAccDataSourceDnsRecordSet_basic[Debug log]
TestAccApigeeAddonsConfig_apigeeAddonsTestExample[Debug log]

Tests failed during RECORDING mode:
TestAccDataSourceGoogleFirebaseAppleApp[Error message] [Debug log]
TestAccDataSourceGoogleFirebaseAppleAppConfig[Error message] [Debug log]
TestAccDataSourceGoogleFirebaseAndroidApp[Error message] [Debug log]
TestAccFirebaseHostingSite_firebasehostingSiteFullExample[Error message] [Debug log]
TestAccFirebaseAppleApp_update[Error message] [Debug log]
TestAccFirebaseAppleApp_firebaseAppleAppFullExample[Error message] [Debug log]
TestAccFirebaseAppleApp_firebaseAppleAppBasicExample[Error message] [Debug log]
TestAccFirebaseAndroidApp_update[Error message] [Debug log]
TestAccFirebaseAndroidApp_firebaseAndroidAppBasicExample[Error message] [Debug log]
TestAccFirebaseWebApp_firebaseWebAppSkipDelete[Error message] [Debug log]
TestAccFirebaseHostingSite_firebasehostingSiteUpdate[Error message] [Debug log]
TestAccFirebaseWebApp_firebaseWebAppFull[Error message] [Debug log]
TestAccDataSourceDnsManagedZone_basic[Error message] [Debug log]

Please fix these to complete your PR
View the build log or the debug log for each test

@roaks3
Copy link
Contributor Author

roaks3 commented Feb 14, 2023

/gcbrun

@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.

Terraform GA: Diff ( 3 files changed, 11 insertions(+), 11 deletions(-))
Terraform Beta: Diff ( 14 files changed, 30 insertions(+), 25 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2470
Passed tests 2198
Skipped tests: 256
Failed tests: 16

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccFrameworkProviderMeta_setModuleName|TestAccDataSourceGoogleFirebaseAppleApp|TestAccDataSourceGoogleFirebaseAppleAppConfig|TestAccDataSourceGoogleFirebaseAndroidApp|TestAccFirebaseAppleApp_firebaseAppleAppBasicExample|TestAccFirebaseWebApp_firebaseWebAppSkipDelete|TestAccFirebaseHostingSite_firebasehostingSiteUpdate|TestAccFirebaseWebApp_firebaseWebAppFull|TestAccFirebaseHostingSite_firebasehostingSiteFullExample|TestAccFirebaseAppleApp_update|TestAccFirebaseAppleApp_firebaseAppleAppFullExample|TestAccFirebaseAndroidApp_update|TestAccFirebaseAndroidApp_firebaseAndroidAppBasicExample|TestAccDataSourceDnsManagedZone_basic|TestAccComputeForwardingRule_update|TestAccDataSourceDnsRecordSet_basic

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccFrameworkProviderMeta_setModuleName[Debug log]
TestAccDataSourceGoogleFirebaseAppleApp[Debug log]
TestAccDataSourceGoogleFirebaseAppleAppConfig[Debug log]
TestAccDataSourceGoogleFirebaseAndroidApp[Debug log]
TestAccFirebaseAppleApp_firebaseAppleAppBasicExample[Debug log]
TestAccFirebaseWebApp_firebaseWebAppSkipDelete[Debug log]
TestAccFirebaseHostingSite_firebasehostingSiteUpdate[Debug log]
TestAccFirebaseWebApp_firebaseWebAppFull[Debug log]
TestAccFirebaseHostingSite_firebasehostingSiteFullExample[Debug log]
TestAccFirebaseAppleApp_update[Debug log]
TestAccFirebaseAppleApp_firebaseAppleAppFullExample[Debug log]
TestAccFirebaseAndroidApp_update[Debug log]
TestAccFirebaseAndroidApp_firebaseAndroidAppBasicExample[Debug log]
TestAccComputeForwardingRule_update[Debug log]
TestAccDataSourceDnsRecordSet_basic[Debug log]

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

Please fix these to complete your PR
View the build log or the debug log for each test

@trodge trodge requested a review from melinath February 14, 2023 18:16
Copy link
Contributor

@trodge trodge left a comment

Choose a reason for hiding this comment

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

LGTM, adding Stephen for a second review.

@melinath melinath self-assigned this Feb 14, 2023
Copy link
Member

@melinath melinath left a comment

Choose a reason for hiding this comment

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

lgtm

@roaks3
Copy link
Contributor Author

roaks3 commented Feb 14, 2023

I accidentally rebased main so had to force-push, but the only change is this: 448a78f

The delete URLs in the sweeper were also incorrect, so this change fixes them.

Confirmed that the AppleApp sweeper correctly sweeps now, and the tf-test added here is necessary to identify the apps.

@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.

Terraform GA: Diff ( 3 files changed, 20 insertions(+), 35 deletions(-))
Terraform Beta: Diff ( 14 files changed, 39 insertions(+), 49 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2471
Passed tests 2210
Skipped tests: 256
Failed tests: 5

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccFirebaserulesRelease_BasicRelease|TestAccApigeeAddonsConfig_apigeeAddonsTestExample|TestAccFrameworkProviderMeta_setModuleName|TestAccDataSourceDnsRecordSet_basic|TestAccDataSourceDnsManagedZone_basic

@melinath
Copy link
Member

@roaks3 is there some way we can verify in CI that these are working properly now or do we need to test manually locally?

@roaks3
Copy link
Contributor Author

roaks3 commented Feb 14, 2023

@melinath With our current setup, I don't think there is a way to automatically test these before merge. If we decided to build something to support it, you could potentially create fake resources with eg. gcloud, or make a test fail before cleanup, and then run the sweeper and verify the resource no longer exists. That's just one example, but basically, I think there are some options but they would probably introduce some complexity and a longer CI runtime.

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccFirebaserulesRelease_BasicRelease[Debug log]
TestAccApigeeAddonsConfig_apigeeAddonsTestExample[Debug log]
TestAccFrameworkProviderMeta_setModuleName[Debug log]
TestAccDataSourceDnsRecordSet_basic[Debug log]

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

Please fix these to complete your PR
View the build log or the debug log for each test

@roaks3
Copy link
Contributor Author

roaks3 commented Feb 14, 2023

Oh and I guess to add to that, these sweepers in particular were not sweeping, but they did not produce an error or anything that might be easier to detect. Since they were looking in the wrong field of the response, they simple behaved as if there were no resources to sweep.

@roaks3 roaks3 merged commit e68b6d5 into main Feb 14, 2023
@roaks3 roaks3 deleted the fix-firebase-app-sweepers branch February 14, 2023 22:52
kubalaguna pushed a commit to kubalaguna/magic-modules that referenced this pull request Feb 27, 2023
* Fix firebase app sweepers

* Fix test override quotes

* Fix delete urls in sweeper
ericayyliu pushed a commit to ericayyliu/magic-modules that referenced this pull request Jul 26, 2023
* Fix firebase app sweepers

* Fix test override quotes

* Fix delete urls in sweeper
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.

4 participants