Skip to content

Commit

Permalink
Update test since EnsureValidClient does not retry 2 times now.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Willey committed Feb 12, 2022
1 parent 26b9b08 commit 64681b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions Microsoft.Azure.Cosmos/src/DocumentClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,7 @@ public void Dispose()
if (this.initTaskCache != null)
{
this.initTaskCache.Dispose();
this.initTaskCache = null;
}

DefaultTrace.TraceInformation("DocumentClient with id {0} disposed.", this.traceId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public async Task CosmosHttpClientRetryValidation()
}
catch (CosmosException rte)
{
Assert.IsTrue(handler.Count >= 6);
Assert.IsTrue(handler.Count >= 3, $"HandlerCount: {handler.Count}; Expecte 6");
string message = rte.ToString();
Assert.IsTrue(message.Contains("Start Time"), "Start Time:" + message);
Assert.IsTrue(message.Contains("Total Duration"), "Total Duration:" + message);
Expand All @@ -129,9 +129,10 @@ private class TransientHttpClientCreatorHandler : DelegatingHandler

protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
if (this.Count++ <= 3)
this.Count++;
if (this.Count < 3)
{
throw new WebException();
throw new WebException($"Mocked WebException {this.Count}");
}

throw new TaskCanceledException();
Expand Down

0 comments on commit 64681b7

Please sign in to comment.