This message was deleted.
s
This message was deleted.
l
My recommendation is: 1) all config should be accessed only in your Pulumi program (index.ts, or your language's equivalent), and 2) only unit test your ComponentResources. This avoids all complexities like you describe.
Move all your unit-testable code into resources and test those. There should be next to no logic in the top-level file (index.ts or whatever). Any logic in there can be tested using integration / system level testing.
f
I am only testing a single function that creates a resource group and storage account (azure). So I guess you are saying I should move the reading of the config value out of that function? Just trying think through how this should look.
l
Yes. Pass in the value, from both the program and the unit test.
That's a good practice in any language or framework. Minimize dependencies within each function. If a function does a thing, it shouldn't get-config-then-do-thing.
f
Ok seems to make sense. Thanks will give it a try.
👍 1