https://pulumi.com logo
Title
r

ripe-russia-4239

07/15/2020, 8:00 PM
In my unit tests, I want to be able to make use of the config values for a given stack, so that I can verify that, for example, resources are deployed to the NorthEurope region in Azure even though that’s only specified in my stack config files and not in my Pulumi app. How can I go about doing this? I suspect the config-loading behaviour is overridden by the
setMocks()
call, but I haven’t verified that yet.
g

gentle-diamond-70147

07/15/2020, 8:24 PM
Unfortunately, we don't currently support Config in tests. This is being tracked at https://github.com/pulumi/pulumi/issues/4472.
Config is available in Policies via Crossguard - https://www.pulumi.com/docs/get-started/crossguard/.
r

ripe-russia-4239

07/15/2020, 8:32 PM
Ok, thanks @gentle-diamond-70147. Seems like there’s a possible workaround with the
PULUMI_CONFIG
environment variable, or am I misunderstanding that?
g

gentle-diamond-70147

07/15/2020, 8:34 PM
That's a good way to mock your configuration for the purposes of running the tests.
👍 1