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

Return error from getMonitorID instead of panic #2632

Conversation

guineveresaenger
Copy link

@guineveresaenger guineveresaenger commented Apr 10, 2024

Description

fix: Adds error handling and slice length check for getMonitorId synthetics resource helpers.

Fixes #2631

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.

How to test this change?

I am a little unclear on how to build/test this provider locally. The contributor instructions do not say how to set up my TF configuration to use a local provider. Unfortunately, internet results vary as well.

I also am unable to run make test; I get errors relating to build constraints:

 make test
tools.go:7:2: import "github.com/bflad/tfproviderlint/cmd/tfproviderlint" is a program, not an importable package
=== terraform-provider-newrelic === [ tools            ]: Installing tools required by the project...
package github.com/newrelic/terraform-provider-newrelic/v2/tools: build constraints exclude all Go files in /Users/guin/go/src/github.com/guineveresaenger/terraform-provider-newrelic/tools
make: *** [tools] Error 1

To test, I would build this provider locally and run the program that triggered the panic and hopefully get an error instead!
update: I figured out how to attach a local provider binary and with that I get an error as expected.

I am very happy to work with you on testing but I'd like some pointers on how to set up a local provider and why make is failing for me.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@pranav-new-relic
Copy link
Member

pranav-new-relic commented Apr 23, 2024

Thank you for the contribution, @guineveresaenger - we would like to take this further via PR #2640 as our team believes there is scope for further error handling and better test coverage of such a scenario, so we shall continue to build via the PR linked above to resolve the issue you've posted :) thank you again for helping set a direction and giving us hints, via this PR!

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.

synthetics_multilocation_alert_condition panic: getMonitorID() fails with panic on wrong monitor ID
3 participants