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,nodejs,python}] Fix DeletedWith resource option #11883

Merged
merged 1 commit into from Jan 16, 2023

Conversation

justinvp
Copy link
Member

This change fixes the DeletedWith resource option in the Go, Node.js, and Python SDKs and adds tests.

This feature was a community contribution and while there were engine tests included with the original PR, there weren't any tests confirming the functionality worked correctly from each SDK.

Here's a summary of the fixes:

  • Go: The DeletedWith resource option was never usable as it accepted a URN instead of a Resource. We discussed this internally a while back and decided to go ahead and fix this. (Note: While changing the signature is technically a breaking change, the feature is currently unusable, so the change would not break anyone, so there's no need to wait for a major version bump.)

  • Node.js: The deletedWith resource option did not work at all from the Node.js SDK because it was incorrectly passing the resource object itself in the RegisterResource request, rather than the resource's URN.

  • Python: The deleted_with resource option did not work at all from the Python SDK because it was incorrectly passing the resource object itself in the RegisterResource request, rather than the resource's URN.

A FailsOnDelete resource has been added to the testprovider, which will fail when its Delete gRPC is called. The tests use this to ensure Delete is not called for resources of this type with the DeletedWith option specified.

Fixes #11358
Fixes #11622

@pulumi-bot
Copy link
Contributor

Changelog

[uncommitted] (2023-01-16)

Bug Fixes

  • [sdk/{go,nodejs,python}] Fix DeletedWith resource option
    #11883

@@ -0,0 +1,24 @@
// Copyright 2016-2023, Pulumi Corporation. All rights reserved.
Copy link
Member Author

Choose a reason for hiding this comment

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

It might be worth considering moving testprovider to its own repo and publishing it. Then we could use it from this repo and others (like pulumi-dotnet, pulumi-java, etc.), and we wouldn't need to have multiple copies of these hand-written files for calling the resources in the provider in each test that uses them.

Copy link
Member

Choose a reason for hiding this comment

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

I think pretty much the entire integration test set should be callable from each language repo, not sure if that means testprovider needs to be moved out to it's own repo as well or not though. And as you'll have seen in dotnet I re-wrote the testprovider to C# in that repo, might make sense to do that for other languages as well.

This change fixes the `DeletedWith` resource option in the Go, Node.js,
and Python SDKs and adds tests.

This feature was a community contribution and while there were engine
tests included with the original PR, there weren't any tests confirming
the functionality worked correctly from each SDK.

Here's a summary of the fixes:

* Go: The `DeletedWith` resource option was never usable as it accepted
  a URN instead of a Resource. We discussed this internally a while back
  and decided to go ahead and fix this. (Note: While changing the
  signature is technically a breaking change, the feature is currently
  unusable, so the change would not break anyone, so there's no need to
  wait for a major version bump.)

* Node.js: The `deletedWith` resource option did not work at all from
  the Node.js SDK because it was incorrectly passing the resource object
  itself in the RegisterResource request, rather than the resource's
  URN.

* Python: The `deleted_with` resource option did not work at all from
  the Python SDK because it was incorrectly passing the resource object
  itself in the RegisterResource request, rather than the resource's
  URN.

A `FailsOnDelete` resource has been added to the testprovider, which
will fail when its `Delete` gRPC is called. The tests use this to ensure
`Delete` is not called for resources of this type with the `DeletedWith`
option specified.
@justinvp justinvp requested a review from Frassle January 16, 2023 00:35
@justinvp justinvp changed the title [sdk/{go,nodejs,python}] Fix DeletedWith` resource option [sdk/{go,nodejs,python}] Fix DeletedWith resource option Jan 16, 2023
@@ -0,0 +1,9 @@
// Copyright 2016-2023, Pulumi Corporation. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

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

It is very lame we have to write each of these integration test 6 times (python, nodejs, go, dotnet, java, yaml). Are we ever going to prioritize matrix testing to fix this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, we should talk more about how/when we can get to it.

@justinvp
Copy link
Member Author

bors merge

@bors
Copy link
Contributor

bors bot commented Jan 16, 2023

Build succeeded:

@bors bors bot merged commit 60195d6 into master Jan 16, 2023
@bors bors bot deleted the justin/deletedwith branch January 16, 2023 20:07
@same-id
Copy link
Contributor

same-id commented Jan 17, 2023

Thanks for taking this to the finish line

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.

"deletedWith" is ignored New resource option DeletedWith accepts a URN instead of a Resource
4 participants