Support tests and test directory.
Some commands have no-tests and -test-directory parameters.
-
Implement test. -
Add test directory support to SourceSet -
Update the configureXYZmethods inOpenTofuModelandTerraformModelto add test directory support when configuring the listed commands -
Check lifecycle includes these tasks. -
Inputs depends on file patterns mentioned below (and in the docs). -
Command will always be run with -jsonand the output post-processed. -
If failure is due to tests failed or tests erroring, the raised exception will indicate as such
Supported command-line options
Terraform
-
-test-directory. Default will betests. -
-filter. Can be supplied be more than once. -
-var&-var-file. -
-verbose. -
-parallelism. -
-junit-xmlwill not be an option, but will always be included and will write a report to an appropriate directory underreports. -
Generate an HTML report from the JUnit XML output.
NOTE: Terraform's -cloud-run will not be supported. It might be done in a future request.
OpenTofu
-
-test-directory. Default will betests. -
-filter. Can be supplied be more than once. -
-var&-var-file. -
-verbose. -
Capture JSON output to a file. -
Will convert processed JSON to a JUnit XML file.
References
Some notes from the docs
Each Terraform test lives in a test file. Terraform discovers test files are based on their file extension: .tftest.hcl or .tftest.json.
This [OpenTofu] command will execute all *.tftest.hcl, *.tftest.json, *.tofutest.hcl, and *.tofutest.json files in the current directory or in a directory called tests.
Edited by Schalk W. Cronjé