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(entity_tags): fixed improper error handling in newrelic_entity_tags resource #2710

Merged
merged 4 commits into from
Jul 17, 2024

Conversation

shashank-reddy-nr
Copy link
Contributor

Description

Currently, In newrelic_entity_tags resource there is improper error handling when we try to update reserved tags(default tags which will be added when we create entity). Please check out the below JIRA ticket for more info.

JIRA Ticket: https://new-relic.atlassian.net/browse/NR-273648

Fixes

Added a new function CreateErrorDiagnostics which will print all errors if present in the response called nerdgraph APIs. The CreateErrorDiagnostics function is called in resourceNewRelicEntityTagsCreate, resourceNewRelicEntityTagsUpdate, resourceNewRelicEntityTagsDelete.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

Please delete options that are not relevant.

  • My commit message follows conventional commits
  • My code is formatted to Go standards
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes. Go here for instructions on running tests locally.

@pranav-new-relic
Copy link
Member

@shashank-reddy-nr if you find we have no relevant test cases that validate errors thrown inside the response body of entity tags create and update mutations, can you please add a relevant test case which throws the error you've added (and can be validated by regex of the error)

@pranav-new-relic pranav-new-relic changed the title fix: fixed improper err handling in newrelic_entity_tags resource fix(entity_tags): fixed improper err handling in newrelic_entity_tags resource Jul 8, 2024
@pranav-new-relic
Copy link
Member

@shashank-reddy-nr please also add a note to the docs of this resource stating that modifying values of restricted tags is not supported by the create and update mutations; consequently, this is not supported by this resource as well - you can add this link as a reference to these restricted tags

@shashank-reddy-nr
Copy link
Contributor Author

@shashank-reddy-nr if you find we have no relevant test cases that validate errors thrown inside the response body of entity tags create and update mutations, can you please add a relevant test case which throws the error you've added (and can be validated by regex of the error)

Added integration test cases to validate errors thrown : newrelic/newrelic-client-go#1188

@pranav-new-relic pranav-new-relic changed the title fix(entity_tags): fixed improper err handling in newrelic_entity_tags resource fix(entity_tags): fixed improper error handling in newrelic_entity_tags resource Jul 15, 2024
@pranav-new-relic pranav-new-relic merged commit b20516b into main Jul 17, 2024
13 of 14 checks passed
@pranav-new-relic pranav-new-relic deleted the NR-273648 branch July 17, 2024 09:22
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.

2 participants