This message was deleted.
# general
s
This message was deleted.
r
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.
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
The code in config.spec.ts suggests that what you're trying should work (
pulumi.runtime.setConfig('azure:tenantId', uuid());
). 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
pulumi.runtime.runInPulumiStack(func)
.
r
@little-cartoon-10569 That's a neat trick, thanks!