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 provider crash when netbox connection is unavailable #126

Merged
merged 2 commits into from
Feb 24, 2022

Conversation

twink0r
Copy link
Contributor

@twink0r twink0r commented Feb 23, 2022

Hi folks!

While writing tests and run make testacc I forgot to change the URL in my local provider configuration and the provider crashes with a SIGSEGV. Some other users already reported this issue (#110).

Cheers

@fbreckle
Copy link
Collaborator

I know all contributors love this: Can you please add tests for this? :D

Just run against example.com or so and then expect an error. I'm actually somewhat at a loss on how to exactly do this. Maybe look at https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/provider/provider_test.go

If you don't feel like jumping through this hoop, I can just merge as-is and add tests later.

@twink0r
Copy link
Contributor Author

twink0r commented Feb 23, 2022

I will dig into this later today!

@twink0r
Copy link
Contributor Author

twink0r commented Feb 24, 2022

@fbreckle I added a test for configure the Netbox Provider the to a non-existing URL that broke and let the Provider crash before. It was a nightmare to get this test to work because there is no documentation for this kind of tests. Maybe "someone" should add a test for missing required attributes?

@fbreckle fbreckle merged commit 2c17af2 into e-breuninger:master Feb 24, 2022
@fbreckle
Copy link
Collaborator

I'm not completely sold on having to make a custom configure func for the tests.

I'm not even sure if the version detection functionality is in the correct file, maybe it "belongs" to config.go

However, I find it good enough as is.

@twink0r twink0r mentioned this pull request May 31, 2022
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