-
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
Support remote components in Python #5375
Conversation
1f00c2d
to
c48aab3
Compare
pkg/testing/integration/program.go
Outdated
// a package.json being emitted in the project directory and `yarn install && yarn link @pulumi/pulumi` | ||
// being run. | ||
// When the underlying issue has been fixed, the use of this environment variable should be removed. | ||
if os.Getenv("PULUMI_TEST_YARN_LINK_PULUMI") != "" { |
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.
Went with an env variable to temporarily enable this, instead of exposing an actual option on ProgramTestOptions
, since this is just a temporary workaround.
Originally, I tried doing this as part of building the tests in the Makefile
after:
Lines 71 to 72 in b4c2a35
test_build:: $(SUB_PROJECTS:%=%_install) | |
cd tests/integration/construct_component/testcomponent && yarn install && yarn link @pulumi/pulumi && yarn run tsc |
But our beloved CopyFile
utility function that we use to copy the test project dir to a temp dir, doesn't handle copying the symlinks that get created inside the node_modules
dir when yarn link
ing @pulumi/pulumi
.
remote: jspb.Message.getBooleanFieldWithDefault(msg, 21, false) | ||
remote: jspb.Message.getBooleanFieldWithDefault(msg, 20, false) |
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 regenerated the protobuf files because they were stale after changing the remote
field from 21 to 20 per https://github.com/pulumi/pulumi/pull/5280/files/9ff12da5cc6477e8f3b4ed17115b1d9bde1e9c39#r483125014
case "child-b": | ||
assert.Equal(t, []resource.URN{urns["a"]}, res.PropertyDependencies["echo"]) | ||
case "child-c": | ||
assert.ElementsMatch(t, []resource.URN{urns["child-a"], urns["a"]}, | ||
res.PropertyDependencies["echo"]) |
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.
Note: These cases are slightly different than the Node test, because our Node.js SDK filters out ComponentResources from dependencies, but Python does not.
pulumi/sdk/nodejs/runtime/resource.ts
Lines 392 to 419 in 2585b86
async function getAllTransitivelyReferencedCustomResourceURNs(resources: Set<Resource>) { | |
// Go through 'resources', but transitively walk through **Component** resources, collecting any | |
// of their child resources. This way, a Component acts as an aggregation really of all the | |
// reachable custom resources it parents. This walking will transitively walk through other | |
// child ComponentResources, but will stop when it hits custom resources. in other words, if we | |
// had: | |
// | |
// Comp1 | |
// / \ | |
// Cust1 Comp2 | |
// / \ | |
// Cust2 Cust3 | |
// / | |
// Cust4 | |
// | |
// Then the transitively reachable custom resources of Comp1 will be [Cust1, Cust2, Cust3]. It | |
// will *not* include `Cust4`. | |
// To do this, first we just get the transitively reachable set of resources (not diving | |
// into custom resources). In the above picture, if we start with 'Comp1', this will be | |
// [Comp1, Cust1, Comp2, Cust2, Cust3] | |
const transitivelyReachableResources = await getTransitivelyReferencedChildResourcesOfComponentResources(resources); | |
const transitivelyReachableCustomResources = [...transitivelyReachableResources].filter(r => CustomResource.isInstance(r)); | |
const promises = transitivelyReachableCustomResources.map(r => r.urn.promise()); | |
const urns = await Promise.all(promises); | |
return new Set<string>(urns); | |
} |
So for Python, we need to include the component resources here.
c48aab3
to
239adbe
Compare
239adbe
to
5254a01
Compare
29d13ab
to
dc050f8
Compare
Fixes #5354