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

Disable SSL certificate validation in Cosmos tests #25528

Merged
merged 1 commit into from
Aug 16, 2021
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Net.Http;
using Microsoft.Azure.Cosmos;
using Microsoft.EntityFrameworkCore.Infrastructure;

namespace Microsoft.EntityFrameworkCore.TestUtilities
Expand All @@ -10,8 +12,16 @@ public static class CosmosDbContextOptionsBuilderExtensions
{
public static CosmosDbContextOptionsBuilder ApplyConfiguration(this CosmosDbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.ExecutionStrategy(d => new TestCosmosExecutionStrategy(d));
optionsBuilder.RequestTimeout(TimeSpan.FromMinutes(1));
optionsBuilder
.ExecutionStrategy(d => new TestCosmosExecutionStrategy(d))
.RequestTimeout(TimeSpan.FromMinutes(20))
.HttpClientFactory(
() => new HttpClient(
new HttpClientHandler
{
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
}))
.ConnectionMode(ConnectionMode.Gateway);

return optionsBuilder;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ private CosmosTestStore(
AuthToken = TestEnvironment.AuthToken;
ConnectionString = TestEnvironment.ConnectionString;
_configureCosmos = extensionConfiguration == null
? (Action<CosmosDbContextOptionsBuilder>)(b => b.ApplyConfiguration())
: (b =>
? b => b.ApplyConfiguration()
: b =>
{
b.ApplyConfiguration();
extensionConfiguration(b);
});
};

_storeContext = new TestStoreContext(this);

Expand Down