Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ private async Task ProcessPartitionAsync(PartitionSupervisor partitionSupervisor
}

await this.RemoveLeaseAsync(lease: lease, wasAcquired: true).ConfigureAwait(false);

partitionSupervisor.Dispose();
}

private async Task HandlePartitionGoneAsync(DocumentServiceLease lease, string lastContinuationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public async Task Controller_ShouldSignalSynchronizerSplitPartition_IfPartitionS
await sut.ShutdownAsync().ConfigureAwait(false);

Mock.Get(synchronizer).VerifyAll();

Mock.Get(partitionSupervisor)
.Verify(s => s.Dispose(), Times.Once);
}

[TestMethod]
Expand Down Expand Up @@ -76,6 +79,9 @@ public async Task Controller_ShouldPassLastKnownContinuationTokenToSynchronizer_
await sut.ShutdownAsync().ConfigureAwait(false);

Mock.Get(synchronizer).VerifyAll();

Mock.Get(partitionSupervisor)
.Verify(s => s.Dispose(), Times.Once);
}

[TestMethod]
Expand Down Expand Up @@ -108,6 +114,9 @@ public async Task Controller_ShouldCopyParentLeaseProperties_IfPartitionSplitHap
.VerifySet(l => l.Properties = customProperties, Times.Once);
Mock.Get(leaseChild2)
.VerifySet(l => l.Properties = customProperties, Times.Once);

Mock.Get(partitionSupervisor)
.Verify(s => s.Dispose(), Times.Once);
}

[TestMethod]
Expand All @@ -132,6 +141,9 @@ public async Task Controller_ShouldKeepParentLease_IfSplitThrows()
await sut.ShutdownAsync().ConfigureAwait(false);

Mock.Get(leaseManager).Verify(manager => manager.DeleteAsync(lease), Times.Never);

Mock.Get(partitionSupervisor)
.Verify(s => s.Dispose(), Times.Once);
}

[TestMethod]
Expand Down Expand Up @@ -180,6 +192,13 @@ public async Task Controller_ShouldRunProcessingOnChildPartitions_IfHappyPath()

monitor.Verify(m => m.NotifyLeaseAcquireAsync(leaseChild1.CurrentLeaseToken), Times.Once);
monitor.Verify(m => m.NotifyLeaseReleaseAsync(leaseChild2.CurrentLeaseToken), Times.Once);

Mock.Get(partitionSupervisor)
.Verify(s => s.Dispose(), Times.Once);
Mock.Get(partitionSupervisor1)
.Verify(s => s.Dispose(), Times.Once);
Mock.Get(partitionSupervisor2)
.Verify(s => s.Dispose(), Times.Once);
}

[TestMethod]
Expand Down