-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[sdk/python] Handle unknown results from methods #7677
Conversation
|
||
resolve_value.set_result(value) | ||
resolve_is_known.set_result(True) | ||
resolve_is_known.set_result(is_known) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel we're coding against a very low-level interface here so it sounds like it was an easy mistake to make.
tests/integration/construct_component_methods_unknown/testcomponent-python/testcomponent.py
Outdated
Show resolved
Hide resolved
Curious, the integration tests are fine here but how do you feel about using Mock-based tests instead? I think this could run against a MockMonitor and exercise the changes in rpc.py but maybe I'm mistaken. They're a bit more tedious but run faster. Or would that lose essential coverage? |
Update the existing Python methods test to include a type check in the method result class, to match what would be generated from the SDK, for some extra coverage.
ff07ffe
to
7b9539f
Compare
Good point. We could probably have Mock-based tests for this, but I think I'd still additionally want integration tests to test E2E. Also, at some point soon I hope to be able to add SDK generation for many of these integration tests (generate SDKs for the provider resources based on a schema, to fully exercise the codegen + runtime), so in some ways this is setting the stage for that. |
This fixes handling of unknown results from methods in the Python SDK. Node.js and Go were already handling this appropriately.
This adds tests in each of the languages. The test program passes an unknown value to the provider, and asserts that an
apply
is not run for it, and then returns the value, and the program asserts that anapply
does not run on the result. The Python test program fails before the fix and succeeds after.Fixes #7670