Closed amhn closed 1 year ago
I am not very familiar with test in golang but it's really a good idea. We can start with manual tests on our computer but the best for the future would be to integrate this into the CI.
I did some more work on this and I think it might be ready for merging.
There are currently 3 Tests for each resource: Minimal: Only required fields are set. Full: All possible fields are set. MinimalFullMinimal: Create a minimal resource, update to set all fields and go back to the first, possibly with an intermediate step to prevent errors on destroying the other resources.
I am currently working on a check for the last scenario to detect if the resource has been recreated. But I don't think this needs to go into this PR.
Still in draft ?
I think that is just the label. I don't think I have the necessary permissions to remove it.
fixes: #155
This is a draft PR to experiment with Test cases.
Tests can be started with
The netbox connection can be configured with the NETBOX_ env vars. NETBOX_TOKEN is required.
Some ids are currently hard-coded as there is no resource yet to set them up. Notably cluster_id for virtualization_vm and rir_id for ipam_aggregate,
TestAccNetboxVirtualizationVMPrimaryIPAddress is a test case for the current problem in https://github.com/smutel/terraform-provider-netbox/pull/147
To keep this PR small, the dependencies are not yet added to vendor/.
Do you think this is a direction worth going?
This is the current output: