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

required output can be mocked #247

Closed
wants to merge 2 commits into from

Conversation

jasond-s
Copy link

@jasond-s jasond-s commented Mar 26, 2024

fixes the same issue as seen in issue #9212 for the typescript sdk.

@jasond-s jasond-s requested a review from a team as a code owner March 26, 2024 16:04
? result
: throw new KeyNotFoundException(
$"Required output '{v.Item1}' does not exist on stack '{v.Item2}'."));
$"Required output '{v.Item1}' does not exist on stack '{base.GetResourceName()}'."));
Copy link
Member

Choose a reason for hiding this comment

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

This will return the logical name of the stack reference resource rather than the name of the stack. Given the phrasing of the message that's probably not what's really wanted?
I think the issue here is that FakeStackOutputMocks doesn't return the name output.

Copy link
Member

Choose a reason for hiding this comment

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

Yup raised #260 to add a test showing how to do this. Just requires the mock to return the "name" output as well as the "outputs" for the stack.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, this test example is much clearer. I think I missed it as I was debugging through looking for .Name for resources and not .Type is there any documentation on the meaning of these different props on the args to mocks?

I am still getting a lot of errors in my test code, but I think they are probably just more missing mocks.

Copy link
Member

Choose a reason for hiding this comment

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

is there any documentation on the meaning of these different props on the args to mocks?

Not that I know of, certainly doesn't look like anything on https://www.pulumi.com/docs/using-pulumi/testing/unit/#add-mocks. Worth raising a bug to the docs repo (https://github.com/pulumi/docs) asking for more written on this.

@jasond-s jasond-s closed this Apr 23, 2024
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.

2 participants