Skip to content

Commit

Permalink
Disable SSL certificate validation in Cosmos tests (dotnet#25528)
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Aug 16, 2021
1 parent ae18686 commit 9207cce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
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

0 comments on commit 9207cce

Please sign in to comment.