-
Notifications
You must be signed in to change notification settings - Fork 258
Description
Summary
The Pulumi testing framework doesn't support lifecycle hooks or transforms when using mocks. This is a known limitation that needs to be documented.
Background
Customer reported that Pulumi.Testing.MockMonitor.RegisterResourceHookAsync is not implemented (.NET), causing unit tests to fail when stacks include hooks. Tests work fine when hooks are removed.
Root Cause
The mock server doesn't contain a full engine implementation needed to trigger hooks/transforms. While hooks and transforms can register with the mock server, they won't actually execute during tests. Implementing this would require reimplementing significant portions of the engine in each language SDK, which isn't worthwhile.
Action Items
Document in the testing/mocking documentation that:
- Lifecycle hooks are not executed in mock tests
- Transforms are not executed in mock tests (if not already documented)
- Tests should be structured to work around this limitation
Related