Show / Hide Table of Contents

Interface IMocks

Hooks to mock the engine that provide test doubles for offline unit testing of stacks.

Namespace: Pulumi.Testing
Assembly: Pulumi.dll
Syntax
public interface IMocks

Methods

View Source

CallAsync(MockCallArgs)

Invoked when the program needs to call a provider to load data (e.g., to retrieve an existing resource).

Declaration
Task<object> CallAsync(MockCallArgs args)
Parameters
Type Name Description
MockCallArgs args

MockCallArgs

Returns
Type Description
Task<object>

Invocation result, can be either a POCO or a dictionary bag.

View Source

NewResourceAsync(MockResourceArgs)

Invoked when a new resource is created by the program.

Declaration
Task<(string? id, object state)> NewResourceAsync(MockResourceArgs args)
Parameters
Type Name Description
MockResourceArgs args

MockResourceArgs

Returns
Type Description
Task<(string id, object state)>

A tuple of a resource identifier and resource state. State can be either a POCO or a dictionary bag. The returned ID may be null for component resources.

View Source

RegisterInvokeTransform(InvokeTransform)

Invoked when the program registers an invoke transform. The mock monitor does not run transforms; implementations that want to exercise them can record the transform here and call it from CallAsync(MockCallArgs).

Declaration
Task RegisterInvokeTransform(InvokeTransform transform)
Parameters
Type Name Description
InvokeTransform transform

The registered transform.

Returns
Type Description
Task
View Source

RegisterResourceOutputs(MockRegisterResourceOutputsRequest)

Invoked when component resources (including instances of Stack) register their outputs

Declaration
Task RegisterResourceOutputs(MockRegisterResourceOutputsRequest args)
Parameters
Type Name Description
MockRegisterResourceOutputsRequest args

MockRegisterResourceOutputsRequest

Returns
Type Description
Task
View Source

RegisterTransform(ResourceTransform)

Invoked when the program registers a stack transform. The mock monitor does not run transforms; implementations that want to exercise them can record the transform here and call it from NewResourceAsync(MockResourceArgs).

Declaration
Task RegisterTransform(ResourceTransform transform)
Parameters
Type Name Description
ResourceTransform transform

The registered transform.

Returns
Type Description
Task

Version 3.113.1

  • View Source
Back to top Copyright 2016-2023, Pulumi Corporation.