Class: RubyTerraform::Commands::Test
- Includes:
- Options::Global
- Defined in:
- lib/ruby_terraform/commands/test.rb
Overview
Wraps the terraform test command which executes automated integration tests defined in .tftest.hcl files.
Terraform discovers test files in the configured test directory (by default tests) and in the root module, then runs each run block in turn, reporting on the outcome of the assertions.
For options accepted on construction, see Base#initialize.
When executing an instance of Test via Base#execute, the following options are supported:
-
:chdir: the path of a working directory to switch to before executing the given subcommand. -
:cloud_run: if set, executes the tests remotely using the given Terraform Cloud/Enterprise module source address rather than running them locally. -
:filter: restrict which test files are executed; if both:filterand:filtersare provided, all filters will be passed to terraform. -
:filters: an array of test file paths to restrict which test files are executed; if both:filterand:filtersare provided, all filters will be passed to terraform. -
:json: whether or not to produce output in a machine-readable JSON format; defaults tofalse. -
:no_color: whether or not the output from the command should be in color; defaults tofalse. -
:test_directory: the directory containing test files; defaults to “tests”. -
:vars: a map of variables to be passed to the terraform configuration. -
:var_file: the path to a terraform var file; if both:var_fileand:var_filesare provided, all var files will be passed to terraform. -
:var_files: an array of paths to terraform var files; if both:var_fileand:var_filesare provided, all var files will be passed to terraform. -
:verbose: whentrue, print the plan or state for each test run block as it executes; defaults tofalse.
The Base#execute method accepts an optional second parameter which is a map of invocation options. Currently, the only supported option is :environment which is a map of environment variables to expose during invocation of the command.
Method Summary
Methods inherited from Base
Constructor Details
This class inherits a constructor from RubyTerraform::Commands::Base