Skip to content

Support tests and test directory.

Some commands have no-tests and -test-directory parameters.

  • Implement test.
  • Add test directory support to SourceSet
  • Update the configureXYZ methods in OpenTofuModel and TerraformModel to 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 -json and 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 be tests.
  • -filter. Can be supplied be more than once.
  • -var & -var-file.
  • -verbose.
  • -parallelism.
  • -junit-xml will not be an option, but will always be included and will write a report to an appropriate directory under reports.
  • 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 be tests.
  • -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é
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information