https://pulumi.com logo
t

tall-monitor-77779

03/19/2019, 12:10 PM
guys, last time I checked, there was no way to unit test pulumi stacks (eg. the desired resource output for complex apps). Has this changed? Specifically TypeScript/Javascript
p

proud-artist-4864

03/19/2019, 12:51 PM
How would you “test” the result of creating infrastructure?
t

tall-monitor-77779

03/19/2019, 12:57 PM
I have complex logic that creates resources based on various factors, initial I want to ensure that, giving a certain input, specific resources are created
p

proud-artist-4864

03/19/2019, 1:10 PM
hmm, interesting question 🙂 this is similar to mock DBs and equivalent in TDD development world. It should be possible to have a mock provider that recorded the resource creation process and be able to compare the results. Not sure that exists though (yet).
t

tall-monitor-77779

03/19/2019, 2:22 PM
yeah I was thinking sinon.js, but wondered if there was a standard way for pulumi, I remember having troubles before. Refer to this post some months ago and a reply from @white-balloon-205 https://pulumi-community.slack.com/archives/C84L4E3N1/p1543587290005700
c

colossal-room-15708

03/19/2019, 11:29 PM
p

proud-artist-4864

03/20/2019, 4:19 AM
I think they are both very good questions 😄
From a testing perspective, because of the resource dependencies, I can see a number of possibilities: 1. A more detailed “pulumi preview” that shows the dependency graph and the pre-execution resolved inputs/outputs. 2. A possible “mock” provider that would provide consistent responses as if the resource creation had been invoked and a fully resolved dependency graph.