I’m trying to do something similar to <this exampl...
# general
I’m trying to do something similar to this example, which illustrates how to use the Azure SDK to fetch data that can’t be queried through the Pulumi resource model. When I unit test my code, I can intercept the
call, as that is a provider function on the azure-native provider. That is, it can be handled in the
function as defined in the unit testing documentation. The code I have for calling the Azure SDK is in an ApplyT. Is it possible to intercept this as well, and specify the return value in a similar way as with the provider functions, or will I have to handle this by creating an interface I can mock?
Are you testing component resources? The preferred solution here is to not test the Azure SDK: it's already tested by Microsoft. If you have the calls to the SDK outside your component resources, and pass the resulting objects / values into the component resources' constructors, then this problem goes away.
Bringing a functional approach to components makes testing a lot easier.
Thanks for the feedback, @little-cartoon-10569. This was indeed the right way to go
👍 1