worried-engineer-33884
05/20/2019, 5:34 PMmy_resource.some_output.apply(lambda val: print(val))
, I get back another output that I believe has a future wrapped up in it that will execute my lambda. When does that actually get awaited?white-balloon-205
05/20/2019, 5:36 PMsome_output
is available (either after a resource is created or updated) the Pulumi engine will cause that future to be resolved with the value of the resource returned by the cloud provider.worried-engineer-33884
05/20/2019, 5:37 PMwhite-balloon-205
05/20/2019, 5:48 PMworried-engineer-33884
05/20/2019, 5:55 PMdef test_bucket_name_is_my_bucket():
from infrastructure import bucket_name
assert bucket_name() == "my-bucket"
@pytest.mark.asyncio
async def test_bucket_urn_is_my_bucket():
from infrastructure import bucket
bucket_urn = await get_output(bucket.urn)
assert bucket_urn.endswith("aws:s3/bucket:Bucket::my-bucket")
def get_output(output):
future = asyncio.Future()
output.apply(lambda value: future.set_result(value))
return future