Skip to content

Commit

Permalink
edit failover test, add failoverable status codes 401 and 403 (#595)
Browse files Browse the repository at this point in the history
  • Loading branch information
amerjusupovic authored Oct 2, 2024
1 parent ca08677 commit 1206330
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,9 @@ private bool IsFailOverable(RequestFailedException rfe)
{
if (rfe.Status == HttpStatusCodes.TooManyRequests ||
rfe.Status == (int)HttpStatusCode.RequestTimeout ||
rfe.Status >= (int)HttpStatusCode.InternalServerError)
rfe.Status >= (int)HttpStatusCode.InternalServerError ||
rfe.Status == (int)HttpStatusCode.Forbidden ||
rfe.Status == (int)HttpStatusCode.Unauthorized)
{
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Tests.AzureAppConfiguration/FailoverTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ public void FailOverTests_AutoFailover()
mockClient1.Setup(c => c.GetConfigurationSettingsAsync(It.IsAny<SettingSelector>(), It.IsAny<CancellationToken>()))
.Throws(new RequestFailedException(503, "Request failed."));
mockClient1.Setup(c => c.GetConfigurationSettingAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))
.Throws(new RequestFailedException(503, "Request failed."));
.Throws(new RequestFailedException(403, "Forbidden."));
mockClient1.Setup(c => c.GetConfigurationSettingAsync(It.IsAny<ConfigurationSetting>(), It.IsAny<bool>(), It.IsAny<CancellationToken>()))
.Throws(new RequestFailedException(503, "Request failed."));
.Throws(new RequestFailedException(401, "Unauthorized."));
mockClient1.Setup(c => c.Equals(mockClient1)).Returns(true);

var mockClient2 = new Mock<ConfigurationClient>();
Expand Down

0 comments on commit 1206330

Please sign in to comment.