The tool can simplify the process to test an ARM REST API. It can generate a terraform file containing dependencies and a terraform file containing the testing resource which is based on the azapi provider. It can also generate a markdown report when found API issues.
Usage: armstrong [--version] [--help] <command> [<args>]
Available commands are:
auto Run generate and test, if test passed, run cleanup
cleanup Clean up dependencies and testing resource
generate Generate testing files including terraform configuration for dependencies and testing resource.
setup Update dependencies for tests
test Update dependencies for tests and run tests
validate Generates a speculative execution plan, showing what actions Terraform would take to apply the current configuration
- Install this tool:
go install github.com/ms-henglu/armstrong
, or download it from releases. - Generate terraform files and Test
-
Generate testing files by running
armstrong generate -path {path to a swagger 'Create' example}
. Here's an example:armstrong generate -path .\2021-07-01\examples\Compute\createOrUpdate\ComputeInstanceMinimal.json
.Then
dependency.tf
andtesting.tf
will be generated. It also supports generatebody
with raw json format, by adding option-raw
. You can append more test cases by executing this command with different example paths, this feature is enabled by default, to get a clean working directory, use-overwrite
option to clean up the existing files. -
Run API tests by running
armstrong test
. This command will set up dependencies and test the ARM resource API. -
There's an
auto
command, it can generate testing files, then run the tests and remove all resources if test is passed. Example:armstrong auto -path .\2021-07-01\examples\Compute\createOrUpdate\ComputeInstanceMinimal.json
-
-
Q: When use
test
commands, server side validation error happens.A: You may need to modify the dependency.tf or testing.tf to meet the server side's requirements. It happens when the testing resource requires running in specific region or some configurations of its dependencies. After modification, run
test
command to continue the test. -
Q: Will dependencies be removed after testing is done?
A: If using
test
command, resources won't be removed after testing, user must usecleanup
command to remove these resources. If usingauto
command, it will runcleanup
command if test passed,
- Generate multiple test cases from given resource type and swagger file
- Generate test cases containing all defined properties
- Support complicated dependency analysis, ex: key vault id, key vault cert id
- Support appending more testcases.
- Support
body
in bothjsonencode
format and raw json format. - Improve accuracy in mapping between resourceId and azurerm resource type
- Improve accuracy in azurerm resource example configuration: example configuration must be valid
- Hide terraform logs and generate a more friendly report
- Generate Markdown report when there are API issues