https://pulumi.com logo
#golang
Title
g

gifted-city-99717

06/02/2020, 4:57 PM
It appear functions like
ec2.LookupVpc
don’t perform lookups in [unit] tests. Are there any examples of mocking them out?
l

lemon-agent-27707

06/02/2020, 5:27 PM
I don't believe we have an example test that mocks out a get call. You can see the implementation of the mocks here: https://github.com/pulumi/pulumi/blob/master/sdk/go/pulumi/mocks.go any get/lookup function will ultimately call ReadResource wich calls NewResource in turn.
We do have an internal test in the Go SDK that tests ReadResource which may be useful reference: https://github.com/pulumi/pulumi/blob/master/sdk/go/pulumi/run_test.go#L155
g

gifted-city-99717

06/09/2020, 2:35 PM
👍 thanks for this. This helped
3 Views