904 B
904 B
Module testing notes
Generating test inventory files
- Specify
inventory=filename.yamlin thetftestannotation inREADME.md. - Create the empty inventory file in
tests/modules/<module_name>/examples/(note the underscore in module name, e.g.,compute_vm). - Place the standard copyright blurb at the top.
- Add
counts: { foo: 1 }to the inventory file. - Run the specific test using
pytest "tests/examples/test_plan.py::test_example[terraform:modules/<module-name>:Heading Name:Index]". - Use the test failure output to replace
countswith the actual resource types and counts. - Add
values: { foo: 1 }to the inventory file and run the test again. - Use the output to replace
valueswith the actual mapped attributes. Remove unnecessary or overly verbose keys like large instance configurations, and use{}for resources where specific values don't need validation.