This commit incorporates the tests introduced by @henriiik in #8585 into
the existing test suite for the NodeJS SDK mocks. SDK mocks provide a
means for users wishing to unit test their Pulumi programs to stub out
various bits of Pulumi behaviour. Previously, those wanting to stub out
resource reads (through `.get` static methods) would encounter crashes
or use untested code paths. With the crashes fixed in previous commits,
this commit adds some tests. Moreover, we fix an error whereby mock
reads force a non-custom (component) resource, when in reality it should
be the other way around (since reads don't make sense for component
resources).
Closes#8585
Co-authored-by: Henrik Sjööh <henriiik@gmail.com>
This commit applies the Rome autoformatter to the Node SDK.
These changes are automatically produced. To reproduce these
changes, run `make format` from inside sdk/nodejs.
v3.13.0 introduces support for serializing outputs in inputs as special output value objects in the Node.js and Python SDKs when serializing inputs for remote components and method calls. This functionality is currently disabled by default in the engine (setting the `PULUMI_ENABLE_OUTPUT_VALUES` envvar to a truthy value enables it).
However, unit testing remote components with mocks results in errors being raised in v3.13.0, related to the new output value support. This is due to the mock monitor implementation saying it supports all features (which now includes output values), so the SDK serializers are serializing outputs as output values, which the mock monitor can't handle correctly.
This change addresses the issue by updating the mock monitor implementation in the Node.js and Python SDKs to indicate the specific features that are supported, excluding support for output values. New tests with mocks fail before the change and pass after.
This commit adds a new optional parameter to the `newResource` function
of the `Mocks` interface for TypeScript. This can be useful when writing
tests which assert differing behavior between Custom and Component
resources.
Although the new parameter will always be set, the paramteter is marked
as optional in order to maintain backwards compatibility with existing
implementations of `Mocks`.
The tests are updated to verify that `custom` is set appropriately.
Co-authored-by: Luke Hoban <luke@pulumi.com>