Skip to content

Commit dad1a41

Browse files
committed
Only create a single snapshot per node and reuse it for repeated restores.
1 parent 80d57de commit dad1a41

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Meadow.UnitTestTemplate/ContractTest.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace Meadow.UnitTestTemplate
2121
public abstract class ContractTest
2222
{
2323
#region Fields
24-
private ulong _baseSnapshotID;
24+
private ulong? _baseSnapshotID;
2525
private static Semaphore _sequentialExecutionSemaphore = new Semaphore(1, 1);
2626
#endregion
2727

@@ -98,7 +98,10 @@ public async Task OnTestInitialize()
9898
InternalTestState.StartTime = DateTimeOffset.UtcNow;
9999

100100
// Create a snapshot to revert to when test is completed.
101-
_baseSnapshotID = await TestServices.TestNodeClient.Snapshot();
101+
if (!_baseSnapshotID.HasValue)
102+
{
103+
_baseSnapshotID = await TestServices.TestNodeClient.Snapshot();
104+
}
102105

103106
// Determine what message to log
104107
if (InternalTestState.InExternalNodeContext)

0 commit comments

Comments
 (0)