Skip to content
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/go] Specify known when creating outputs for construct #7343

Merged
merged 6 commits into from
Jun 21, 2021

Conversation

justinvp
Copy link
Member

If an input is an unknown value or contains unknowns, specify false for known when creating the output.

Added integration tests to ensure this is behaving as expected for all languages.

Fixes #7318

If an input is an unknown value or contains unknowns, specify known = false when creating the output.
Provides a Random resource that can be used by languages that don't support dynamic providers but need a custom resource for tests, to avoid having to take a dependency on the pulumi-random provider.
@justinvp justinvp requested review from t0yv0 and pgavlin June 21, 2021 15:41
pathEnv := pathEnv(t,
filepath.Join("..", "testprovider"),
filepath.Join(testDir, test.componentDir))
integration.ProgramTest(t, &integration.ProgramTestOptions{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Interesting so this was just bowing up before the change, no need for extra asserts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Before the change, in the case of the Go-based provider, the Apply inside the provider's component implementation will run because it thinks the value is known, which will panic and fail the test. With the fix, the Apply won't run because we properly pass along unknown, so no panic, and the test succeeds. I wasn't really sure if there was a better way to test this from an integration test.

Copy link
Member

@t0yv0 t0yv0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The more I see the one-liner fix with 1,880 lines of per-language tests, the more I worry about our future supporting N languages 🙂

@justinvp justinvp merged commit 48bbc28 into master Jun 21, 2021
@pulumi-bot pulumi-bot deleted the justin/component_unknown branch June 21, 2021 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Output as component input leads to unknown value
2 participants