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

Change Feed Processor: Fixes initialization when client is set with EnableContentResponseOnWrite #2436

Merged
merged 5 commits into from
Apr 29, 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 @@ -47,11 +47,10 @@ public static async Task<ItemResponse<T>> TryCreateItemAsync<T>(
}

response.EnsureSuccessStatusCode();

return new ItemResponse<T>(
response.StatusCode,
response.Headers,
CosmosContainerExtensions.DefaultJsonSerializer.FromStream<T>(response.Content),
item,
response.Trace);
}
}
Expand All @@ -71,8 +70,8 @@ public static async Task<ItemResponse<T>> TryReplaceItemAsync<T>(
response.EnsureSuccessStatusCode();
return new ItemResponse<T>(
response.StatusCode,
response.Headers,
CosmosContainerExtensions.DefaultJsonSerializer.FromStream<T>(response.Content),
response.Headers,
item,
response.Trace);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class BaseChangeFeedClientHelper : BaseCosmosClientHelper

public async Task ChangeFeedTestInit()
{
await base.TestInit();
await base.TestInit(customizeClientBuilder: (builder) => builder.WithContentResponseOnWrite(false));
string PartitionKey = "/id";

ContainerResponse response = await this.database.CreateContainerAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos.Fluent;

public abstract class BaseCosmosClientHelper
{
Expand All @@ -15,12 +16,14 @@ public abstract class BaseCosmosClientHelper
protected CancellationTokenSource cancellationTokenSource = null;
protected CancellationToken cancellationToken;

public async Task TestInit(bool validateSinglePartitionKeyRangeCacheCall = false)
public async Task TestInit(
bool validateSinglePartitionKeyRangeCacheCall = false,
Action<CosmosClientBuilder> customizeClientBuilder = null)
{
this.cancellationTokenSource = new CancellationTokenSource();
this.cancellationToken = this.cancellationTokenSource.Token;

this.cosmosClient = TestCommon.CreateCosmosClient(validatePartitionKeyRangeCalls: validateSinglePartitionKeyRangeCacheCall);
this.cosmosClient = TestCommon.CreateCosmosClient(validatePartitionKeyRangeCalls: validateSinglePartitionKeyRangeCacheCall, customizeClientBuilder: customizeClientBuilder);
this.database = await this.cosmosClient.CreateDatabaseAsync(Guid.NewGuid().ToString(),
cancellationToken: this.cancellationToken);
}
Expand Down