Commit graph

40 commits

Author SHA1 Message Date
Daniel Schmidt
0529299cc3
run terraform fmt on test 2024-02-23 13:50:46 +01:00
Daniel Schmidt
7ae7a203d8
test: allow using global variables in suite-level variable definitions
Closes #34534
2024-02-20 16:40:30 +01:00
Liam Cervante
9658f9df6b
mocking overrides: default to concrete empty object when values are missing (#34563) 2024-01-24 12:39:58 +01:00
Liam Cervante
430970c02b
terraform test: Fix crash when file level variables reference variables. (#34531)
* terraform test: Fix crash when referencing variables within the file level variable block

* also allow functions within variables blocks

* add tests
2024-01-22 20:00:22 +01:00
Liam Cervante
7e18b1183d
Add test verifying issue #34476 has been fixed (#34478) 2024-01-05 17:05:17 +01:00
Liam Cervante
5cbf7c5f96
Add docs for automatic var files in test directories (#34349) 2023-12-06 08:10:45 +01:00
Kubo
c98e355ca1
terraform test: Collect variables from default var file within testing directory (#34341)
* Add logic to collect variables for terrafrom test

* Add tests for test variable collection

* Update the test variable collection implementation

* Update internal/backend/local/test.go

Co-authored-by: Liam Cervante <liam.cervante@hashicorp.com>

* Update internal/backend/local/test.go

Co-authored-by: Liam Cervante <liam.cervante@hashicorp.com>

* Move test variables into var file

* resolve diff from cross-branch switch

* go fmt

---------

Co-authored-by: Liam Cervante <liam.cervante@hashicorp.com>
2023-12-04 08:15:56 +01:00
Liam Cervante
9ea1aa0a86
terraform test: skip destroy step for empty run blocks (#34331) 2023-11-30 16:38:23 +01:00
Liam Cervante
6670ab43f7
terraform test: rearrange the order of destroy operations (#34293) 2023-11-29 16:37:52 +01:00
Liam Cervante
dedb296773
terraform test: connect mock behaviour to test framework (#34205)
* connect mock behaviour to test framework

* fix calling unconfigured providers
2023-11-14 08:50:37 +01:00
Liam Cervante
57edb9c248
testing framework: add warnings for override blocks with invalid targets (#34181)
* testing framework: add warnings for override blocks with invalid targets

* pre-add the override sources for upcoming features

* address comments
2023-11-13 10:36:06 +01:00
Liam Cervante
b9f6b23ba3
testing framework: add support for functions in variables and providers (#34204) 2023-11-13 09:25:32 +01:00
Liam Cervante
ad77877136
terraform test: remove marks before passing variables as inputs to a plan (#34190)
* remove marks before passing variables as inputs to a plan

* fix doc comments
2023-11-08 09:34:04 +01:00
Liam Cervante
f90d71f723
testing framework: allow providers to reference run blocks (#34118)
* testing framework: allow providers to reference run block

* missing copywrite header
2023-11-08 09:21:20 +01:00
Liam Cervante
5bbdc4c3b6
terraform test: allow providers in test files to reference variables (#34069)
* Process only relevant variables in the testing framework

* add support for variables within test provider configurations

* remove unused function

* fix consistency checks
2023-10-16 16:57:20 +02:00
Liam Cervante
01c0480e77
Test framework will produce regular updates in -json mode (#33953)
* Test framework will produce regular updates in -json mode

* add tests

* docs

* docs tweaking
2023-10-02 09:14:20 +02:00
Liam Cervante
fba5dad097
Test files should be marked as skipped if all their run blocks were skipped (#33950) 2023-09-28 13:49:14 +02:00
Liam Cervante
f8d4664bcd
Add additional validation around unknown and null values in test variables (#33861)
* Add additional validation around unknown values in test variables

* address comments
2023-09-14 09:44:21 +02:00
Liam Cervante
1c7dfa22b7 Add warning when testing and combining expect_failures with apply operations 2023-09-14 08:47:07 +02:00
Liam Cervante
84e2ebc225 apply defaults when processing variables for assertions 2023-09-14 08:32:25 +02:00
Liam Cervante
041b54fb4b
explicitely disallow duplicate run block names in test files (#33836) 2023-09-09 08:05:37 +02:00
Liam Cervante
a560730376
Make the test command fail if resources could not be cleaned up (#33809)
* Make the test command fail if resources could not be cleaned up

* remove redundant return statement
2023-09-08 19:57:23 +02:00
Liam Cervante
802d49a9ca
Handle null outputs in Terraform test files (#33781) 2023-09-01 16:53:23 +02:00
Liam Cervante
5e63aa01c7
Allow referencing higher level variables from run blocks (#33722) 2023-08-24 16:15:22 +02:00
Liam Cervante
9742f22c4e
Introduce 'run' keyword for referencing outputs from earlier run blocks (#33683)
* introduce 'run' keyword for referencing outputs from earlier run blocks

* fix code consistency
2023-08-16 11:06:00 +02:00
Liam Cervante
126f34e4e8 Implement updates to testing framework based on recent feedback 2023-08-10 10:49:01 +02:00
Liam Cervante
3cce200d0e Fix root cause of race condition in testing framework tests 2023-08-09 16:47:59 +02:00
Liam Cervante
8b764f2e1b
fix race condition in no_provides_in_main test (#33616) 2023-08-02 11:02:26 +02:00
Liam Cervante
3bea1171af
test framework: expand variables available to test assertions (#33611) 2023-08-01 09:59:29 +02:00
Liam Cervante
4560a83721
test framework: include transformed config before validating config (#33608) 2023-08-01 09:47:00 +02:00
Liam Cervante
f397954c52
testing framework: allow users to specify deeply nested testing directories (#33584) 2023-07-27 10:38:21 +02:00
Liam Cervante
4122ba86fc
terraform test: fix crash when using nested modules from test run blocks (#33589) 2023-07-27 10:22:53 +02:00
Liam Cervante
e1019b3641
testing framework: validate the configuration before terraform test (#33559)
* testing framework: call validate on the configuration before running terraform test

* address comments

* make tests pass after merge

* fix tests
2023-07-26 10:56:44 +02:00
Liam Cervante
080ddead6e
testing framework: perform a plan before starting any tests (#33561) 2023-07-26 10:24:25 +02:00
Liam Cervante
c91f91cc9e
testing framework: change test file extension to .tftest.hcl (#33553) 2023-07-20 16:57:05 +02:00
Liam Cervante
6882dd9530
testing framework: introduce test command optional flags (#33504)
* testing framework: introduce test command optional flags

* address consistency checks
2023-07-19 10:07:46 +02:00
Liam Cervante
837716a703
testing framework: finalise expect_failures functionality (#33506) 2023-07-19 09:44:40 +02:00
Liam Cervante
4862812c94
testing framework: introduce interrupts for stopping tests (#33477)
* [testing framework] prepare for beta phase of development

* [Testing Framework] Add module block to test run blocks

* [testing framework] allow tests to define and override providers

* testing framework: introduce interrupts for stopping tests

* remove panic handling, will do it properly later
2023-07-10 14:53:13 +01:00
Liam Cervante
ea162f6ab5
[testing framework] prepare for beta phase of development (#33445) 2023-07-06 15:53:18 +02:00
Liam Cervante
dfc26c2ac4
[Testing Framework] Add test command to Terraform CLI (#33327)
* Add test structure to views package for rendering test output

* Add test file HCL configuration and parser functionality

* Adds a TestContext structure for evaluating assertions against the state and plan

* Add test command to Terraform CLI
2023-06-28 09:37:42 +02:00