Looks like the answer to this is "no", and that config needs to be set explicitly in a unit test context using
pulumi.runtime.setConfig()
, and that the value provided as a key to this function needs to following the same namespacing convention as the stack YAML file.
ripe-russia-4239
09/02/2020, 1:26 PM
What is the expected/supported/etc. way to work with config in unit tests? The
pulumi.runtime.setConfig()
workaround I mentioned above only works for project config and not provider config. My use case is deploying an Azure Function app, secured with Azure Active Directory, for which I need the configured Tenant ID. This is exposed by Pulumi as
azure.config.tenantId
but that isn't available in a unit test setting, nor is it possible to say
setConfig("azure:tenantId", uuid())
and have that value available in a unit test setting.
l
little-cartoon-10569
09/03/2020, 9:12 PM
The code in config.spec.ts suggests that what you're trying should work (
). Maybe the runtime you're updating isn't the one that the tests are using? I had that problem when dealing with stack transformations. My solution was to run the tests inside
No 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.