Hello, how do you test your automation scripts? W...
# automation-api
w
Hello, how do you test your automation scripts? We are writing inline programs to automate creating/deletion of out stacks but with growth of the scripts it's becoming hard to track all changes. I was thinking about integration test to actually create/delete stack to make sure that it's working. Would like to hear about your experience in testing automation scripts in Pulumi :)
b
If you just want to test stack manipulation this should be fairly simple, just use a transient local file state backend in your integration tests since you don't actually care about keeping that state. You can blow the state away after each run.
w
I'm actually looking for a way to create a real infrastructure. What I think of it for now: • use automation scripts to provision real infrastructure • write separate tests that will take stack outputs and will use Provider (AWS, Azure) API to check certain aspect of the infra (tags, network etc)
b
The way I planned on handling this previously: • create a local filestate pulumi backend that I don't care about keeping around after tests finish • provision real infrastructure into a sandbox AWS account • run tests / integration tests against real infrastructure • make best-effort to tear down real infrastructure when tests finish • blow away local pulumi filestate backend • have a separate scheduled task unrelated to this process that regularly nukes the sandbox AWS account to cleanup any orphaned infrastructure