Skip to content

Commit

Permalink
Remove random old connection usage and add explict net461 testing back
Browse files Browse the repository at this point in the history
  • Loading branch information
Mpdreamz committed Sep 6, 2018
1 parent d51d858 commit b4010dd
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 29 deletions.
2 changes: 2 additions & 0 deletions src/Elasticsearch.Net/Connection/HttpConnection-CoreFx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ internal class WebProxy : IWebProxy
public bool IsBypassed(Uri host) => host.IsLoopback;
}


/// <summary> The default IConnection implementation. Uses <see cref="HttpClient"/>.</summary>
public class HttpConnection : IConnection
{
private readonly object _lock = new object();
Expand Down
1 change: 1 addition & 0 deletions src/Elasticsearch.Net/Connection/HttpConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace Elasticsearch.Net
{
/// <summary> The default IConnection implementation. Uses <see cref="HttpWebRequest"/> on the current .NET desktop framework.</summary>
public class HttpConnection : HttpWebRequestConnection
{
}
Expand Down
1 change: 0 additions & 1 deletion src/Tests/Tests.Configuration/EnvironmentConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public EnvironmentConfiguration()
{
SourceSerializer = RandomBoolConfig("SOURCESERIALIZER", randomizer),
TypedKeys = RandomBoolConfig("TYPEDKEYS", randomizer),
OldConnection = RandomBoolConfig("OLDCONNECTION", randomizer),
};
}

Expand Down
2 changes: 0 additions & 2 deletions src/Tests/Tests.Configuration/ITestConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,5 @@ public class RandomConfiguration
{
public bool SourceSerializer { get; set; }
public bool TypedKeys { get; set; }
public bool OldConnection { get; set; }
}

}
1 change: 0 additions & 1 deletion src/Tests/Tests.Configuration/YamlConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public YamlConfiguration(string configurationFile)
{
SourceSerializer = this.RandomBool("source_serializer", randomizer),
TypedKeys = this.RandomBool("typed_keys", randomizer),
OldConnection = this.RandomBool("old_connection", randomizer)
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public TestConnectionSettings(
: ConnectionConfiguration.DefaultConnectionLimit;

internal ConnectionSettings ApplyTestSettings() => this
.ApplyFiddlerProxyWhenNeeded()
//TODO make this random
//.EnableHttpCompression()
#if DEBUG
Expand All @@ -54,13 +53,6 @@ internal ConnectionSettings ApplyTestSettings() => this
foreach (var d in r.DeprecationWarnings) XunitRunState.SeenDeprecations.Add(d);
});

private ConnectionSettings ApplyFiddlerProxyWhenNeeded()
{
if (!TestConfiguration.Instance.Random.OldConnection) return this;
if (!RunningFiddler) return this;
return this.Proxy(new Uri("http://localhost:8888"), null, null);
}

private static SourceSerializerFactory CreateSerializerFactory(SourceSerializerFactory provided)
{
if (provided != null) return provided;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public static class TestConfigurationExtensions
{
//on this branch HttpConnection is either webrequest or httpclient based depending on the TFM
private static IConnection CreateLiveConnection(this ITestConfiguration configuration) =>
configuration.Random.OldConnection ? (IConnection) new HttpWebRequestConnection() : new HttpConnection();
new HttpConnection();

public static IConnection CreateConnection(this ITestConfiguration configuration, bool forceInMemory = false) =>
configuration.RunIntegrationTests && !forceInMemory ? configuration.CreateLiveConnection() : new InMemoryConnection();
Expand Down
2 changes: 0 additions & 2 deletions src/Tests/Tests.Core/Xunit/NestXunitRunOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ private static void DumpConfiguration()
Console.WriteLine($" - Random:");
Console.WriteLine($" \t- {nameof(config.Random.SourceSerializer)}: {config.Random.SourceSerializer}");
Console.WriteLine($" \t- {nameof(config.Random.TypedKeys)}: {config.Random.TypedKeys}");
Console.WriteLine($" \t- {nameof(config.Random.OldConnection)}: {config.Random.OldConnection}");
Console.WriteLine(new string('-', 20));

}
Expand Down Expand Up @@ -115,7 +114,6 @@ private static string ReproduceCommandLine(ConcurrentBag<Tuple<string, string>>

AppendExplictConfig(nameof(RandomConfiguration.SourceSerializer), sb);
AppendExplictConfig(nameof(RandomConfiguration.TypedKeys), sb);
AppendExplictConfig(nameof(RandomConfiguration.OldConnection), sb);

if (runningIntegrations)
sb.Append("integrate ")
Expand Down
18 changes: 5 additions & 13 deletions src/Tests/Tests/ClientConcepts/Connection/HttpConnectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,17 @@ [I] public async Task SingleInstanceOfHttpClient()
connection.ClientCount.Should().Be(1);
}

[I] public async Task MultipleInstancesOfHttpClientWhenRequestTimeoutChanges()
{
await MultipleInstancesOfHttpClientWhen(() => CreateRequestData(TimeSpan.FromSeconds(30)));
}
[I] public async Task MultipleInstancesOfHttpClientWhenRequestTimeoutChanges() =>
await MultipleInstancesOfHttpClientWhen(() => CreateRequestData(TimeSpan.FromSeconds(30)));

[I] public async Task MultipleInstancesOfHttpClientWhenProxyChanges()
{
[I] public async Task MultipleInstancesOfHttpClientWhenProxyChanges() =>
await MultipleInstancesOfHttpClientWhen(() => CreateRequestData(proxyAddress: new Uri("http://localhost:9400")));
}

[I] public async Task MultipleInstancesOfHttpClientWhenAutomaticProxyDetectionChanges()
{
[I] public async Task MultipleInstancesOfHttpClientWhenAutomaticProxyDetectionChanges() =>
await MultipleInstancesOfHttpClientWhen(() => CreateRequestData(disableAutomaticProxyDetection: true));
}

[I] public async Task MultipleInstancesOfHttpClientWhenHttpCompressionChanges()
{
[I] public async Task MultipleInstancesOfHttpClientWhenHttpCompressionChanges() =>
await MultipleInstancesOfHttpClientWhen(() => CreateRequestData(httpCompression: true));
}

private static async Task MultipleInstancesOfHttpClientWhen(Func<RequestData> differentRequestData)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.bat))\src\Artifacts.build.props" />
<PropertyGroup>
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
<VersionPrefix>6.0.0</VersionPrefix>
<VersionSuffix>alpha</VersionSuffix>
<NoWarn>$(NoWarn);xUnit1013</NoWarn>
Expand Down

0 comments on commit b4010dd

Please sign in to comment.