Closed zhukovgreen closed 2 years ago
Hi @zhukovgreen
Ah, interesting. I'm able to reproduce locally. I'm seeing a suspicious warning message:
/site-packages/pulumi/runtime/sync_await.py:94: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
I wonder if there's a race condition on reading the second value in an async context, though I suppose there shouldn't be, since Output.all
should wait until all futures resolve.
Hi @RobbieMcKinstry this issue should be addressed for python3.11 (see https://stackoverflow.com/questions/70303895/python-3-10-asyncio-gather-shows-deprecationwarning-there-is-no-current-event). But it seems it is not the reason of the current issue
@zhukovgreen after a little digging, we discovered that the mocks are expected to return data in the format of the AWS response, not in the format of the Python object.
Both tests will pass if you change:
"availability_zone": "us-east-2a",
to...
"availabilityZone": "us-east-2a",
You can see in the source code that the decorator name maps to the expected field. I'm unsure how else you could figure out the name you need to use in the mock. This may be a bug in the SDK. I will pass this issue along to the team that authors the AWS provider and ask them if it's intentional or not. But in the meantime, you can use this as a workaround.
Thank you @RobbieMcKinstry . Do you think it would be a good idea to raise an exception on not existing attributes? I'd try to contribute to this feature.
Hi @zhukovgreen I'm not sure! We're talking internally about finding a way to correct this mapping so it's less confusing. I'm not sure if we want to introduce a new Exception, though. I'm leaning towards "yes".
What happened?
When use
pulumi.runtime.set_mocks(mock)
, and mock overrides call method, which returns somedict
, then not all fields of thisdict
are reflected in the output object.Steps to reproduce
Expected Behavior
test_example_not_working should pass
Actual Behavior
Output of
pulumi about
Additional context
Seems like this issue causing https://github.com/pulumi/pulumi/discussions/11016
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).