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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose API like pulumi.runtime.setMocks to mock Config and StackReferences #16042

Open
zbuchheit opened this issue Apr 23, 2024 · 0 comments
Open
Labels
area/testing customer/feedback Feedback from customers kind/enhancement Improvements or new features

Comments

@zbuchheit
Copy link

Hello!

  • Vote on this issue by adding a 馃憤 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

Ask from user

Improve upon the unit testing experience in Pulumi by exposing an API similar to pulumi.runtime.setMocks to mock Config and StackReferences.

Additional Details

While it is possible to mock these resources today, it isn't easy. There has been some previous discussion about this experience here as well as overall testing experience feedback in other issues.

Highlighted pain points

  • You can mock calls to newResource and call via pulumi.runtime, but not StackReferences and Config objects. These are required to be mocked or the test will not conclude.
  • Mocking library choices can cause many differences in implementation
  • You need a stubbing library to accomplish the mocking.
    • Must return from stubbed functions
    • Pass the correct nesting level of stubbed functions
    • Verify that stubbed functions are being called

Affected area/feature

Testing SDK

Related issues

#10975
#4472
#9212

@zbuchheit zbuchheit added kind/enhancement Improvements or new features area/testing needs-triage Needs attention from the triage team customer/feedback Feedback from customers labels Apr 23, 2024
@justinvp justinvp removed the needs-triage Needs attention from the triage team label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing customer/feedback Feedback from customers kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

2 participants