-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Documented how to use field validation functions #10472
Conversation
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR hasn't generated any diffs, but I'll let you know if a future commit does. |
docs/content/develop/test/test.md
Outdated
|
||
Unit tests should be added to the appropriate folder in [`magic-modules/mmv1/third_party/terraform/services`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services) in the file called `resource_PRODUCT_RESOURCE_test.go`. (You may need to create this file if it does not already exist. Replace PRODUCT with the product name and RESOURCE with the resource name; it should match the name of the generated resource file.) | ||
|
||
Unit tests should be named like `TestFunctionName` - for example, `TestDiskImageDiffSuppress` tests the `DiskImageDiffSuppress` function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be useful to link an example here. Not necessarily comprehensively explain every type of unit test, but to illustrate the way tests that seek to verify (expected) error states, or other plan diffs, as we currently lack explanation of these specifics in our documentation for how to make handwritten tests. Or at least add a link to https://developer.hashicorp.com/terraform/plugin/sdkv2/testing/acceptance-tests/teststep which goes into a number of the assertions more specifically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an example - let me know what you think! I'm not linking to the acceptance tests doc because these are unit tests rather than acceptance tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perfect! lgtm
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR hasn't generated any diffs, but I'll let you know if a future commit does. |
Resolved hashicorp/terraform-provider-google#16504
Release Note Template for Downstream PRs (will be copied)