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

Add random suffix to Cloud Workstations SA to prevent cross test runs from failing #7362

Conversation

bschaatsbergen
Copy link
Contributor

@bschaatsbergen bschaatsbergen commented Feb 27, 2023

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).
  • 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).
  • Generated Terraform providers, and ran make test and make lint in the generated providers to ensure it passes unit and linter tests.
  • Ran relevant acceptance tests using my own Google Cloud project and credentials (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)

@bschaatsbergen bschaatsbergen requested a review from a team as a code owner February 27, 2023 20:10
@bschaatsbergen bschaatsbergen requested review from trodge and removed request for a team February 27, 2023 20:10
@modular-magician
Copy link
Collaborator

Oops! It looks like you're using an unknown release-note type in your changelog entries:

  • REPLACEME

Please only use the types listed in https://github.com/GoogleCloudPlatform/magic-modules/blob/master/.ci/RELEASE_NOTES_GUIDE.md.

@bschaatsbergen
Copy link
Contributor Author

I see a lot of SAs also being created as following:

resource "google_service_account" "test-account" {
  account_id   = "<%= ctx[:vars]['account_id'] %>"
  display_name = "Test Service Account"
}

What's preferred?

@@ -42,7 +42,7 @@ resource "google_kms_crypto_key" "default" {
}

resource "google_service_account" "default" {
account_id = "cloud-workstations-kms"
account_id = "workstations%{random_suffix}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't defined random_suffix anywhere, but noticed it was present in many tests. Is it being injected automagically?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, it'll be injected when "<%= ctx[:vars]['account_id'] %>" is supplied (alongside a corresponding entry in terraform.yaml)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've used account_id and set it through the terraform.yaml like the other tests do, still confused how this will solve the issue - all the account_id entries in other tests are set to 'my-account'... will this not cause the same issue?

@rileykarson
Copy link
Member

I see a lot of SAs also being created as following:...

That's the preferred method! Per your other comment, the random suffix is injected based on this pattern being used: https://googlecloudplatform.github.io/magic-modules/docs/how-to/add-mmv1-test/#example-configuration-file and https://googlecloudplatform.github.io/magic-modules/docs/how-to/add-mmv1-test/#results

That will add a simple value to documentation, but add the suffix to the test so that we ensure the value is unique.

@modular-magician
Copy link
Collaborator

Oops! It looks like you're using an unknown release-note type in your changelog entries:

  • REPLACEME

Please only use the types listed in https://github.com/GoogleCloudPlatform/magic-modules/blob/master/.ci/RELEASE_NOTES_GUIDE.md.

@bschaatsbergen
Copy link
Contributor Author

@rileykarson can you check my latest commit :)?

…n_key.tf.erb

Co-authored-by: Riley Karson <rileykarson@google.com>
@rileykarson
Copy link
Member

/gcbrun

@rileykarson
Copy link
Member

Looks good, running tests to verify.

@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 ( 1 file changed, 3 insertions(+), 3 deletions(-))
Terraform Beta: Diff ( 2 files changed, 6 insertions(+), 6 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))
TF OiCS: Diff ( 1 file changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2483
Passed tests 2226
Skipped tests: 255
Failed tests: 2

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccWorkstationsWorkstationConfig_workstationConfigEncryptionKeyExample|TestAccFirebaserulesRelease_BasicRelease

@bschaatsbergen
Copy link
Contributor Author

🤔

@rileykarson
Copy link
Member

Re-recording is expected, since we changed the value.

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccWorkstationsWorkstationConfig_workstationConfigEncryptionKeyExample[Debug log]
TestAccFirebaserulesRelease_BasicRelease[Debug log]

All tests passed
View the build log or the debug log for each test

Copy link
Member

@rileykarson rileykarson left a comment

Choose a reason for hiding this comment

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

Rake error can be ignored (rebase would resolve)

mdtro pushed a commit to mdtro/magic-modules that referenced this pull request Mar 2, 2023
… from failing (GoogleCloudPlatform#7362)

Co-authored-by: Riley Karson <rileykarson@google.com>
ericayyliu pushed a commit to ericayyliu/magic-modules that referenced this pull request Jul 26, 2023
… from failing (GoogleCloudPlatform#7362)

Co-authored-by: Riley Karson <rileykarson@google.com>
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.

3 participants