Skip to content

Commit 8db57be

Browse files
Merge branch 'master' into users/dibahl/SDKUnknownCapabilities
2 parents 2f90561 + 171259c commit 8db57be

36 files changed

Lines changed: 3950 additions & 179 deletions

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<PropertyGroup>
3-
<ClientOfficialVersion>3.48.0</ClientOfficialVersion>
3+
<ClientOfficialVersion>3.48.1</ClientOfficialVersion>
44
<ClientPreviewVersion>3.49.0</ClientPreviewVersion>
5-
<ClientPreviewSuffixVersion>preview.0</ClientPreviewSuffixVersion>
5+
<ClientPreviewSuffixVersion>preview.1</ClientPreviewSuffixVersion>
66
<DirectVersion>3.38.0</DirectVersion>
77
<FaultInjectionVersion>1.0.0</FaultInjectionVersion>
88
<FaultInjectionSuffixVersion>beta.0</FaultInjectionSuffixVersion>

Microsoft.Azure.Cosmos/FaultInjection/src/FaultInjectionRuleBuilder.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,11 @@ private void ValidateGatewayConnection()
149149
{
150150
if (serverErrorResult?.GetServerErrorType() != FaultInjectionServerErrorType.TooManyRequests
151151
&& serverErrorResult?.GetServerErrorType() != FaultInjectionServerErrorType.ResponseDelay
152-
&& serverErrorResult?.GetServerErrorType() != FaultInjectionServerErrorType.SendDelay)
152+
&& serverErrorResult?.GetServerErrorType() != FaultInjectionServerErrorType.SendDelay
153+
&& serverErrorResult?.GetServerErrorType() != FaultInjectionServerErrorType.DatabaseAccountNotFound
154+
&& serverErrorResult?.GetServerErrorType() != FaultInjectionServerErrorType.ServiceUnavailable
155+
&& serverErrorResult?.GetServerErrorType() != FaultInjectionServerErrorType.InternalServerError
156+
&& serverErrorResult?.GetServerErrorType() != FaultInjectionServerErrorType.LeaseNotFound)
153157
{
154158
throw new ArgumentException($"{serverErrorResult?.GetServerErrorType()} is not supported for metadata requests.");
155159
}

Microsoft.Azure.Cosmos/FaultInjection/src/FaultInjectionServerErrorType.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,13 @@ public enum FaultInjectionServerErrorType
7272
ServiceUnavailable,
7373

7474
/// <summary>
75-
/// 404:1008 Database account not found from gateway
75+
/// 403:1008 Database account not found from gateway
7676
/// </summary>
7777
DatabaseAccountNotFound,
78+
79+
/// <summary>
80+
/// 410:1022 Lease not Found
81+
/// </summary>
82+
LeaseNotFound,
7883
}
7984
}

Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionServerErrorResultInternal.cs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ public HttpResponseMessage GetInjectedServerError(DocumentServiceRequest dsr, st
461461

462462
httpResponse.Headers.Add(
463463
WFConstants.BackendHeaders.SubStatus,
464-
((int)SubStatusCodes.RUBudgetExceeded).ToString(CultureInfo.InvariantCulture));
464+
((int)SubStatusCodes.Unknown).ToString(CultureInfo.InvariantCulture));
465465
httpResponse.Headers.Add(WFConstants.BackendHeaders.LocalLSN, lsn);
466466

467467
return httpResponse;
@@ -470,7 +470,7 @@ public HttpResponseMessage GetInjectedServerError(DocumentServiceRequest dsr, st
470470

471471
httpResponse = new HttpResponseMessage
472472
{
473-
StatusCode = HttpStatusCode.NotFound,
473+
StatusCode = HttpStatusCode.Forbidden,
474474
Content = new FauntInjectionHttpContent(
475475
new MemoryStream(
476476
FaultInjectionResponseEncoding.GetBytes($"Fault Injection Server Error: DatabaseAccountNotFound, rule: {ruleId}"))),
@@ -488,6 +488,28 @@ public HttpResponseMessage GetInjectedServerError(DocumentServiceRequest dsr, st
488488

489489
return httpResponse;
490490

491+
case FaultInjectionServerErrorType.LeaseNotFound:
492+
493+
httpResponse = new HttpResponseMessage
494+
{
495+
StatusCode = HttpStatusCode.Gone,
496+
Content = new FauntInjectionHttpContent(
497+
new MemoryStream(
498+
FaultInjectionResponseEncoding.GetBytes($"Fault Injection Server Error: LeaseNotFound, rule: {ruleId}"))),
499+
};
500+
501+
foreach (string header in headers.AllKeys())
502+
{
503+
httpResponse.Headers.Add(header, headers.Get(header));
504+
}
505+
506+
httpResponse.Headers.Add(
507+
WFConstants.BackendHeaders.SubStatus,
508+
((int)SubStatusCodes.LeaseNotFound).ToString(CultureInfo.InvariantCulture));
509+
httpResponse.Headers.Add(WFConstants.BackendHeaders.LocalLSN, lsn);
510+
511+
return httpResponse;
512+
491513
default:
492514
throw new ArgumentException($"Server error type {this.serverErrorType} is not supported");
493515
}

Microsoft.Azure.Cosmos/contracts/API_3.48.1.txt

Lines changed: 1703 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)