Add terraform-plugin-testing documentation for query mode and query checks #1451
Merged
stephybun merged 4 commits intof/plugin-testing-1-14-0from Dec 10, 2025
Merged
Conversation
…ation to refer to new testing mode
12 tasks
Contributor
Vercel Previews Deployed
|
Contributor
Broken Link CheckerNo broken links found! 🎉 |
SBGoods
approved these changes
Dec 8, 2025
| @@ -0,0 +1,95 @@ | |||
| --- | |||
| page_title: 'Plugin Development - Acceptance Testing: Query Checks' | |||
Contributor
There was a problem hiding this comment.
Suggested change
| page_title: 'Plugin Development - Acceptance Testing: Query Checks' | |
| page_title: 'Plugin Development - Acceptance Testing: Custom Query Checks' |
akinross
reviewed
Dec 9, 2025
| `, | ||
| Query: true, | ||
| QueryResultChecks: []querycheck.QueryResultCheck{ | ||
| querycheck.ExpectResultLengthExact("test_resource.test", 3), |
There was a problem hiding this comment.
from what I noticed during initial try this function does not exist, assume this refers to https://github.com/hashicorp/terraform-plugin-testing/blob/main/querycheck/expect_result_length_exact.go#L34
Suggested change
| querycheck.ExpectResultLengthExact("test_resource.test", 3), | |
| querycheck.ExpectLength("test_resource.test", 3), |
akinross
reviewed
Dec 9, 2025
Comment on lines
+322
to
+331
| []querycheck.KnownValueCheck{, | ||
| { | ||
| tfjsonpath.New("attr_3"), | ||
| knownvalue.StringExact("foobar"), | ||
| }, | ||
| { | ||
| tfjsonpath.New("attr_4"), | ||
| knownvalue.StringExact("baz"), | ||
| }, | ||
| }, |
There was a problem hiding this comment.
I notice a comma added that should not be there in line 322, and perhaps from example point of view it is better readable in format below
Suggested change
| []querycheck.KnownValueCheck{, | |
| { | |
| tfjsonpath.New("attr_3"), | |
| knownvalue.StringExact("foobar"), | |
| }, | |
| { | |
| tfjsonpath.New("attr_4"), | |
| knownvalue.StringExact("baz"), | |
| }, | |
| }, | |
| []querycheck.KnownValueCheck{ | |
| querycheck.KnownValueCheck{ | |
| Path: tfjsonpath.New("attr_3"), | |
| KnownValue: knownvalue.StringExact("foobar"), | |
| }, | |
| querycheck.KnownValueCheck{ | |
| Path: tfjsonpath.New("attr_4"), | |
| KnownValue: knownvalue.StringExact("baz"), | |
| }, | |
| }, |
stephybun
added a commit
that referenced
this pull request
Dec 10, 2025
### What This PR contains a copy of the existing v1.13.x `terraform-plugin-testing` docs in preparation for adding documentation on query mode acceptance testing in v1.14.x⚠️ Should only be merged after #1451 has been merged into this branch⚠️ ### Why To make it easier to see the diff of what was actually added or changed by the addition of the query testing mode docs ### Screenshots <!-- Optional. Show additions to the sidebar or new formatting. --> ---------- ### Merge Checklist _If items do not apply to your changes, add (N/A) and mark them as complete._ #### Pull Request - [ ] Description links to related pull requests or issues, if any. #### Content - [ ] You added redirects to `content/terraform-docs-common/redirects.jsonc` for moved, renamed, or deleted pages **across all affected versions**. Refer to [Redirects](https://github.com/hashicorp/web-unified-docs/blob/main/docs/content-guide/redirects.md#example-redirects) for examples and guidance. - [ ] Links to related content where appropriate (e.g., CLI, language, API endpoints, permissions, etc.). - [ ] Pages with related content are updated and link to this content when appropriate. - [ ] Sidebar navigation files have been updated for added, deleted, reordered, or renamed pages. - [ ] New pages have metadata (page name and description) at the top. - [ ] New images are 2048 px wide. They have HashiCorp standard annotation color (#F92672) and format (rectangle with rounded corners), blurred sensitive details (e.g. credentials, usernames, user icons), and descriptive alt text in the markdown for accessibility. - [ ] New code blocks have the correct syntax and line breaks to eliminate horizontal scroll bars. - [ ] UI elements (button names, page names, etc.) are bolded. - [ ] The Vercel website preview successfully deployed. #### Reviews - [ ] I or someone else reviewed the content for technical accuracy. - [ ] I or someone else reviewed the content for typos, punctuation, spelling, and grammar.
hashibot-web
added a commit
that referenced
this pull request
Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This PR adds documentation for the newly introduced query testing mode as well as the accompanying query checks
What was added:
query-checkscontainingTestStepssubsection forquery modeWhat changed:
TestStepspage was updated to include mentions and references to the new query modeWhy
Terraform introduced a new language construct which users will likely want to know how to test.
Screenshots
Merge Checklist
If items do not apply to your changes, add (N/A) and mark them as complete.
Pull Request
Content
content/terraform-docs-common/redirects.jsoncfor moved, renamed, or deleted pages across all affected versions. Refer to Redirects for examples and guidance.Reviews