Skip to content

Commit

Permalink
Bump Elastic.Transport
Browse files Browse the repository at this point in the history
  • Loading branch information
Mpdreamz committed Jul 10, 2023
1 parent 2269651 commit 00d3ce1
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<ItemGroup>
<ProjectReference Include="..\Elastic.Channels\Elastic.Channels.csproj" />
<PackageReference Include="Elastic.Transport" Version="0.4.11" />
<PackageReference Include="Elastic.Transport" Version="0.4.12" />
<PackageReference Include="System.Threading.Channels" Version="4.7.1" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<ItemGroup>
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.0.4" />
<PackageReference Include="Elastic.Elasticsearch.Xunit" Version="0.4.0" />
<PackageReference Include="Elastic.Elasticsearch.Xunit" Version="0.4.3" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System;
using System.Linq;
using Elastic.Clients.Elasticsearch;
Expand All @@ -9,6 +10,7 @@
using Elastic.Transport;
using Xunit;
using Xunit.Abstractions;
using static Elastic.Elasticsearch.Managed.DetectedProxySoftware;

[assembly: TestFramework("Elastic.Elasticsearch.Xunit.Sdk.ElasticTestFramework", "Elastic.Elasticsearch.Xunit")]

Expand All @@ -18,29 +20,47 @@ namespace Elastic.Ingest.Elasticsearch.IntegrationTests;
public class IngestionCluster : XunitClusterBase
{
protected static string Version = "8.7.0";

public IngestionCluster() : this(new XunitClusterConfiguration(Version) { StartingPortNumber = 9202 }) { }

public IngestionCluster(XunitClusterConfiguration xunitClusterConfiguration) : base(xunitClusterConfiguration) { }

public ElasticsearchClient CreateClient(ITestOutputHelper output) =>
this.GetOrAddClient(_ =>
this.GetOrAddClient(cluster =>
{
var hostName = (System.Diagnostics.Process.GetProcessesByName("mitmproxy").Any()
? "ipv4.fiddler"
: "localhost");
var nodes = NodesUris(hostName);
var isCi = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("CI"));
var nodes = NodesUris();
var connectionPool = new StaticNodePool(nodes);
var settings = new ElasticsearchClientSettings(connectionPool)
.Proxy(new Uri("http://ipv4.fiddler:8080"), null!, null!)
.RequestTimeout(TimeSpan.FromSeconds(5))
.ServerCertificateValidationCallback(CertificateValidations.AllowAll)
.OnRequestCompleted(d =>
{
try { output.WriteLine(d.DebugInformation);}
// ON CI only logged failed requests
// Locally we just log everything for ease of development
try
{
if (isCi)
{
if (!d.HasSuccessfulStatusCode)
output.WriteLine(d.DebugInformation);
}
else output.WriteLine(d.DebugInformation);
}
catch
{
// ignored
}
})
.EnableDebugMode();
.EnableDebugMode()
//do not request server stack traces on CI, too noisy
.IncludeServerStackTraceOnError(!isCi);
if (cluster.DetectedProxy != None)
{
var proxyUrl = cluster.DetectedProxy == Fiddler ? "ipv4.fiddler" : "localhost";
settings = settings.Proxy(new Uri($"http://{proxyUrl}:8080"), null!, null!);
}
return new ElasticsearchClient(settings);
});
}
Expand All @@ -49,8 +69,6 @@ public class SecurityCluster : IngestionCluster
{
public SecurityCluster() : base(new XunitClusterConfiguration(Version, ClusterFeatures.Security)
{
StartingPortNumber = 9202, TrialMode = XPackTrialMode.Trial
,

StartingPortNumber = 9202, TrialMode = XPackTrialMode.Trial,
}) { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public abstract class IntegrationTestBase<TCluster> : IClusterFixture<TCluster>
protected ElasticsearchClient Client { get; }


protected IntegrationTestBase(IngestionCluster cluster, ITestOutputHelper output)
protected IntegrationTestBase(TCluster cluster, ITestOutputHelper output)
{
Cluster = cluster;
Client = cluster.CreateClient(output);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Elastic.Transport.VirtualizedCluster" Version="0.4.10" />
<PackageReference Include="Elastic.Transport.VirtualizedCluster" Version="0.4.12" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 00d3ce1

Please sign in to comment.