sparse-intern-71089
10/25/2022, 12:39 PMlittle-cartoon-10569
10/25/2022, 7:55 PMstack.up()
? up()
isn't a unit of work and isn't appropriate for unit testing. You could try integration or full end-to-end testing instead?little-cartoon-10569
10/25/2022, 7:55 PMbrash-hairdresser-60389
10/26/2022, 3:47 PMup()
, think, for example, a kind of deployer if a hypothetic deploy()
function internally makes use of the stack.up()
, what I’d like to do is to mock the internal automation stuff and, test the unit, read the deploy()
function.
What I tried was to mock the inline builder function
to mimic the error case and a success case (regardless of a real Pulumi program because the unit is not the Pulumi program but the function using the Pulumi automation). To do that, I used:
1. error case - a builder function returning a function throwing an exception
2. success case - a builder function returning a function with any logic inside
using this approach is the only way I figured out how to have a unit test of a unit using the Automation APIlittle-cartoon-10569
10/26/2022, 7:53 PMlittle-cartoon-10569
10/26/2022, 7:54 PMlittle-cartoon-10569
10/26/2022, 7:55 PMNo matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by