Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Internal] UnitTests: Fixes flaky test and properly dispose of object #2477

Merged
merged 5 commits into from
May 19, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -219,8 +219,7 @@ public async Task GetDatabaseAccountFromAnyLocationsMockTestAsync()
Assert.AreEqual(globalEndpointResult, databaseAccount);
Assert.AreEqual(2, slowPrimaryRegionHelper.SlowEndpointCount);
Assert.IsTrue(slowPrimaryRegionHelper.ReturnedSuccess);
Assert.IsTrue(stopwatch.Elapsed > TimeSpan.FromSeconds(5));
Assert.IsTrue(stopwatch.Elapsed < TimeSpan.FromSeconds(10));
Assert.IsTrue(stopwatch.Elapsed > TimeSpan.FromSeconds(1));
}

// All but the last URI succeeds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ public sealed class LocationCacheTests
private GlobalPartitionEndpointManager partitionKeyRangeLocationCache;
private Mock<IDocumentClientInternal> mockedClient;

[TestCleanup]
public void TestCleanup()
{
if (this.endpointManager != null)
{
try
{
this.endpointManager.Dispose();
j82w marked this conversation as resolved.
Show resolved Hide resolved
}
catch (Exception) { }
}
}

[TestMethod]
[Owner("atulk")]
public void ValidateWriteEndpointOrderWithClientSideDisableMultipleWriteLocation()
Expand Down