Skip to content

Document limitation: Lifecycle hooks and transforms don't work in mock tests #16461

@meagancojocar

Description

@meagancojocar

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions