Skip to content

Add a new resource TargetSite. #11669

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

Merged

Conversation

jialei-chen
Copy link
Member

Add a new resource TargetSite to product Discovery Engine.

Release Note Template for Downstream PRs (will be copied)

`google_discovery_engine_target_site`

Copy link

github-actions bot commented Sep 9, 2024

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

@slevenick, 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 ( 5 files changed, 837 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 5 files changed, 837 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 89 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 119 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 11
Passed tests: 10
Skipped tests: 0
Affected tests: 1

Click here to see the affected service packages
  • discoveryengine

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

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccDiscoveryEngineTargetSite_discoveryengineTargetsiteBasicExample[Error message] [Debug log]

$\textcolor{red}{\textsf{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 ( 5 files changed, 837 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 5 files changed, 837 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 89 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 119 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 11
Passed tests: 10
Skipped tests: 0
Affected tests: 1

Click here to see the affected service packages
  • discoveryengine

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

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccDiscoveryEngineTargetSite_discoveryengineTargetsiteBasicExample[Error message] [Debug log]

$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$

View the build log or the debug log for each test

@jialei-chen
Copy link
Member Author

jialei-chen commented Sep 9, 2024

[Solved]
Hi reviewer @slevenick , nice to e-meet you. I ran automatic tests locally and tried to fix the failure myself, but didn't solve it. Then I created this PR and hope to get some ideas of how to set system-generated resource id properly.

First, I tried to set self_link and delete_url to 'projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores/{{data_store_id}}/siteSearchEngine/targetSites/{{target_site_id}}'. The resource id target_site_id is system-generated (via create API call) instead of user-specified, it seems it doesn't make sense to list target_site_id in section parameters.

Second, I changed to set self_link and delete_url to {{name}} referring to this example, because the output property name is exactly what I need for self_link and delete_url. But the acceptance test is failing.

I checked Debug log to get requests and corresponding responses:

  1. Create dependency resource DataStore: succeeded.
  2. Get the newly created dependency resource DataStore: succeeded.
  3. Create target resource TargetSite: succeeded.
  4. Get the newly created target resource TargetSite: failed (reason)
  5. Delete the target resource TargetSite: should have this step but not because of failure in step 4.
  6. Delete the dependency resource DataStore: succeeded.

…tion, then all 6 requests can return successfully.
@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 ( 5 files changed, 855 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 5 files changed, 855 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 89 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 119 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 11
Passed tests: 10
Skipped tests: 0
Affected tests: 1

Click here to see the affected service packages
  • discoveryengine

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

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccDiscoveryEngineTargetSite_discoveryengineTargetsiteBasicExample[Error message] [Debug log]

$\textcolor{red}{\textsf{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 ( 5 files changed, 1077 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 5 files changed, 1077 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 89 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 119 insertions(+))

Missing test report

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

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

resource "google_discovery_engine_target_site" "primary" {
  failure_reason {
    quota_failure {
      total_required_quota = # value needed
    }
  }
  site_verification_info {
    site_verification_state = # value needed
    verify_time             = # value needed
  }
}

1 similar comment
@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 ( 5 files changed, 1077 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 5 files changed, 1077 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 89 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 119 insertions(+))

Missing test report

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

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

resource "google_discovery_engine_target_site" "primary" {
  failure_reason {
    quota_failure {
      total_required_quota = # value needed
    }
  }
  site_verification_info {
    site_verification_state = # value needed
    verify_time             = # value needed
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 11
Passed tests: 10
Skipped tests: 0
Affected tests: 1

Click here to see the affected service packages
  • discoveryengine

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

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccDiscoveryEngineTargetSite_discoveryengineTargetsiteBasicExample[Error message] [Debug log]

$\textcolor{red}{\textsf{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

Tests analytics

Total tests: 11
Passed tests: 10
Skipped tests: 0
Affected tests: 1

Click here to see the affected service packages
  • discoveryengine

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

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccDiscoveryEngineTargetSite_discoveryengineTargetsiteBasicExample[Error message] [Debug log]

$\textcolor{red}{\textsf{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 ( 5 files changed, 1077 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 5 files changed, 1077 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 89 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 119 insertions(+))

Missing test report

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

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

resource "google_discovery_engine_target_site" "primary" {
  failure_reason {
    quota_failure {
      total_required_quota = # value needed
    }
  }
  site_verification_info {
    site_verification_state = # value needed
    verify_time             = # value needed
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 11
Passed tests: 10
Skipped tests: 0
Affected tests: 1

Click here to see the affected service packages
  • discoveryengine

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

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccDiscoveryEngineTargetSite_discoveryengineTargetsiteBasicExample[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{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 ( 6 files changed, 1200 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 6 files changed, 1200 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 89 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 119 insertions(+))

Missing test report

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

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

resource "google_discovery_engine_target_site" "primary" {
  failure_reason {
    quota_failure {
      total_required_quota = # value needed
    }
  }
  site_verification_info {
    site_verification_state = # value needed
    verify_time             = # value needed
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 12
Passed tests: 11
Skipped tests: 0
Affected tests: 1

Click here to see the affected service packages
  • discoveryengine

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

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccDiscoveryEngineTargetSite_discoveryengineTargetsiteBasicExample_update[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$

View the build log or the debug log for each test

- 'project'
custom_code: !ruby/object:Provider::Terraform::CustomCode
post_create: templates/terraform/post_create/set_computed_name.erb
post_update: templates/terraform/post_update/set_computed_name.erb
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need this post_update as well. It should work only after create because the name should never change

Does it work if you remove this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi Sam, I tested locally, after removing this post_update, the update test couldn't pass because the resource name changed.

I ran cli TF_LOG=DEBUG make testacc TEST=./google/services/discoveryengine TESTARGS='-run=TestAccDiscoveryEngineTargetSite_discoveryengineTargetsiteBasicExample_update' > output.log to dump out debugging log, and got results: https://screenshot.googleplex.com/4izdznRcKyJGs9j

Copy link
Member Author

Choose a reason for hiding this comment

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

Double confirmed with the API owner, we plan not to support udpate operation because:

  1. Update API is not used by UI (Pantheon);
  2. Update API has not been fully tested, and now we expect the customer to do delete-then-recreate for an update.

Thus, for this newly supported resource TargetSite, we will support 4 APIs: get, list, create, delete
I will do the following things:

  1. remove this post_update custom code and update test
  2. mark this resource as immutable

@github-actions github-actions bot requested a review from slevenick September 11, 2024 23:12
@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 ( 5 files changed, 1077 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 5 files changed, 1077 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 89 insertions(+))
Open in Cloud Shell: Diff ( 8 files changed, 238 insertions(+))

Missing test report

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

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

resource "google_discovery_engine_target_site" "primary" {
  failure_reason {
    quota_failure {
      total_required_quota = # value needed
    }
  }
  site_verification_info {
    site_verification_state = # value needed
    verify_time             = # value needed
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 12
Passed tests: 10
Skipped tests: 0
Affected tests: 2

Click here to see the affected service packages
  • discoveryengine

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
  • TestAccDiscoveryEngineTargetSite_discoveryengineTargetsiteAdvancedExample
  • TestAccDiscoveryEngineTargetSite_discoveryengineTargetsiteBasicExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccDiscoveryEngineTargetSite_discoveryengineTargetsiteAdvancedExample[Debug log]
TestAccDiscoveryEngineTargetSite_discoveryengineTargetsiteBasicExample[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$

View the build log or the debug log for each test

Copy link
Contributor

@slevenick slevenick left a comment

Choose a reason for hiding this comment

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

One small change required, I think just remove exactly_one_of

name: 'quotaFailure'
description: |
Site verification state indicating the ownership and validity.
exactly_one_of:
Copy link
Contributor

Choose a reason for hiding this comment

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

This should just be required: true?

Copy link
Contributor

Choose a reason for hiding this comment

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

But the parent object is output: true, so exactly_one_of doesn't make sense here

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, removed exactly_one_of .

@github-actions github-actions bot requested a review from slevenick September 12, 2024 21:08
@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 ( 5 files changed, 1077 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 5 files changed, 1077 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 89 insertions(+))
Open in Cloud Shell: Diff ( 8 files changed, 238 insertions(+))

Missing test report

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

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

resource "google_discovery_engine_target_site" "primary" {
  failure_reason {
    quota_failure {
      total_required_quota = # value needed
    }
  }
  site_verification_info {
    site_verification_state = # value needed
    verify_time             = # value needed
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 12
Passed tests: 12
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages
  • discoveryengine

$\textcolor{green}{\textsf{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 ( 5 files changed, 1076 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 5 files changed, 1076 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 89 insertions(+))
Open in Cloud Shell: Diff ( 8 files changed, 238 insertions(+))

Missing test report

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

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

resource "google_discovery_engine_target_site" "primary" {
  failure_reason {
    quota_failure {
      total_required_quota = # value needed
    }
  }
  site_verification_info {
    site_verification_state = # value needed
    verify_time             = # value needed
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 12
Passed tests: 12
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages
  • discoveryengine

$\textcolor{green}{\textsf{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.

3 participants