https://pulumi.com logo
#general
Title
# general
i

incalculable-engineer-92975

11/21/2019, 2:08 PM
Can we please, please, please get an event notification or overall Promise or defer mechanism that fires when a 'pulumi up' is finished? We're jumping through hoops to have integration tests when a pulumi run is done. In most cases we wrap individual tests in 'apply' or 'all' but that doesn't always work. We just had a case where a test would start before a model was assigned to a variable so we couldn't use either approach and had to switch to an event emitter to hold the test back. This seems ridiculous. Why can't we get an overall 'pulumi up/preview/destroy' is done, run your follow-on code now?
m

miniature-musician-31262

11/21/2019, 2:15 PM
Can you describe your test constraints in a bit more detail? (I’m initially wondering why something like just running your tests literally after the
pulumi
program exits with a status code of
0
doesn’t suffice.)
i

incalculable-engineer-92975

11/21/2019, 2:39 PM
We use the objects created in the 'pulumi up' in our tests. So we can't just run them in a following command.
And yes, I wish we could.
Running them in the 'pulumi up' is the approach recommended by Pulumi.
w

white-balloon-205

11/21/2019, 3:34 PM
`process.on(
exit
, ...)` is one reliable way to run code after all Pulumi resources have been created/updated (or at least everything that will be updated in case a failure causes things to exit early). Does that work for you?
Though I’m still interested in the general pattern here. Pulumi programs typically use
apply
to register work the is dependent on resources being updated or created. Why doesn’t that work for your case?
i

incalculable-engineer-92975

11/21/2019, 4:11 PM
eks_cluster.apply(i = create_alb();r = create_route53(i)); i.apply(test i); r.apply(test r);
the tests have to be layered behind applies to keep them from executing.
and a one-layer apply doesn't work. i.apply fires before i has been completed. so I need i.apply(i.some_property.apply())
and process.on won't work since you can only perform synchronous actions. at least i think so
w

white-balloon-205

11/21/2019, 4:17 PM
i

incalculable-engineer-92975

11/21/2019, 4:18 PM
sounds reasonable - i'll give it a shot - thanks
That works perfectly. I strongly suggest you make that the Pulumi recommendation for running integration tests.