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

clean-truck-93285

05/03/2022, 6:58 PM
Howdy Team, when unit testing. How do you test functions that have parameters? I getting type errors when trying to run tests against my functions. For example, my SQL server function needs information about a vnet, so I pass in a vnet object. When I get to testing, I don't have a vnet object available.
I ended up wrapping all my functions in the CreateInfrastructure function from the unit testing example. Added the CreateInfrastructure function to the main function for provisioning. Then for testing, the CreateInfrastructure returns a struct with every resource type. Now all my templates and tests are in sub folders. Not sure my folder structure the best, but open to suggestions.
16 Views