Skip to content

Testing

David Gee edited this page Nov 26, 2021 · 1 revision

Whilst there are no test files for the Go code, there is a test procedure for any new provider, which you should test on the right device and same software version.

Helpful Guidance

Create simple resources

It doesn't matter whether there are 100 resources in your test bed or a single one. We're testing the provider implementation here and not your .tf file.

For each resource you require in your end-state configuration (achieved through Terraform), create a single example of a resource.

Exercise any enums (via choice-ident) in YANG models and any choice elements by virtual of XPath expressions.

Terraform Steps

  1. Run a terraform init
  2. Run a terraform plan
  3. Run a terraform apply -auto-approve
  4. Change the local .tf file and run another terraform plan
  5. Run a terraform apply -auto-approve and check the local state reflects the remote state
  6. Change the remote state (Junos config group contents) and run a terraform plan
  7. Run a terraform apply -auto-approve and check the local state reflects the remote state
  8. Delete a resouce from the .tf file and run terraform plan, terraform apply -auto-approve
  9. Run terraform destroy -auto-approve and check the local state reflects the remote state

If your remote and local states mirror, then you can consider the provider to work correctly.

Clone this wiki locally