incalculable-elephant-87683
06/19/2025, 4:42 PMStackReference
for unit testing where I'm using RequireOutput
in the stack. I set up mocking to add a value to the output using ImmutableDictionary.CreateBuilder<string, object>()
like in the docs. However, the RequireOutput
throws this exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Output<object> Pulumi.StackReference.RequireOutput(Input<string> name)+(ValueTuple<string, string, ImmutableDictionary<string, object>> v) => { }
at Output<ValueTuple> Pulumi.Output<T>.Apply(Func<T, Task> func)+(T t) => { }
at async Task<OutputData<U>> Pulumi.Output<T>.ApplyHelperAsync<U>(Task<OutputData<T>> dataTask, Func<T, Output<U>> func)
at async Task<OutputData<T>> Pulumi.Output<T>+<>c__DisplayClass12_0.<WithIsSecret>g__GetData|0(?)+GetData(?)
at Pulumi.Deployment.TestAsync(IMocks mocks, Func`2 runAsync, TestOptions options)
at Thread.Uniti.Azure.Environment.Tests.EnvironmentStackTests.InitializeAsync() in /Users/john.marian/Repos/uniti/backend/Infrastructure/Azure/Thread.Uniti.Azure.Environment/tests/EnvironmentStackTests.cs:line 22
at Xunit.v3.XunitTestRunnerBase`2.CreateTestClassInstance(TContext ctxt) in /_/src/xunit.v3.core/Runners/XunitTestRunnerBase.cs:line 62
at Xunit.v3.ExceptionAggregator.RunAsync[T](Func`1 code, T defaultValue) in /_/src/xunit.v3.core/Exceptions/ExceptionAggregator.cs:line 146
incalculable-elephant-87683
06/19/2025, 4:43 PMvar outputs = ImmutableDictionary.CreateBuilder<string, object>();
if (args.Type == "pulumi:pulumi:StackReference")
{
outputs.Add("VirtualNetworkId", "core-vnet-id");
}
gray-ambulance-59402
06/19/2025, 5:14 PMincalculable-elephant-87683
06/19/2025, 5:16 PM