Fix occasional .NET test failure
This avoids the "NotSupportedException : Multiple executions of TestAsync must run serially" from calls to `Deployment.TestAsync` in the mocks test, which can happen if a stack test runs before the mock test (.NET unit tests are run in random order).
@@ -10,7 +10,7 @@ using Xunit.Sdk;
namespace Pulumi.Tests
{
- public class StackTests
+ public class StackTests : IDisposable
{
private class ValidStack : Stack
{
@@ -109,5 +109,12 @@ namespace Pulumi.Tests
var values = await outputs!.DataTask;
return (stack, values.Value);
}
+
+ public void Dispose()
+ {
+ // Always reset the instance after each of these tests as other tests elsewhere
+ // expect it to be initially null.
+ Deployment.Instance = null!;
+ }
}
}
