Skip to content

feature/bump dependencies #70

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

Merged
merged 3 commits into from
May 29, 2025
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
7 changes: 0 additions & 7 deletions Elastic.Abstractions.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Xunit.ExampleMinima
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Managed.Example", "examples\Elastic.Managed.Example\Elastic.Managed.Example.csproj", "{294F5209-AD64-4812-AA4E-C7B016927A0F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nest.TypescriptExporter", "src\Nest.TypescriptExporter\Nest.TypescriptExporter.csproj", "{C05F7B36-EEF7-4BCD-86A2-F5F1BB8CFEB9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Stack.ArtifactsApi", "src\Elastic.Stack.ArtifactsApi\Elastic.Stack.ArtifactsApi.csproj", "{80DE8673-CB3E-4D0B-99F4-A5CECF6BE752}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{77E78EDE-60D5-469A-B431-443A7966A243}"
Expand Down Expand Up @@ -62,7 +60,6 @@ Global
{0FCE020D-F4BD-4933-A0AB-27537EFA273E} = {77E78EDE-60D5-469A-B431-443A7966A243}
{681C6112-B885-4553-A06C-4CD9C262FC49} = {77E78EDE-60D5-469A-B431-443A7966A243}
{80DE8673-CB3E-4D0B-99F4-A5CECF6BE752} = {77E78EDE-60D5-469A-B431-443A7966A243}
{C05F7B36-EEF7-4BCD-86A2-F5F1BB8CFEB9} = {77E78EDE-60D5-469A-B431-443A7966A243}
{D6997ADC-E933-418E-831C-DE1A78897493} = {F75ACC18-D314-4F1F-88A3-2002EAC4E207}
{9666AFDC-B0E8-489C-A25A-17E67303A969} = {9D154338-4AA8-40A9-A378-B27C05D45791}
EndGlobalSection
Expand Down Expand Up @@ -102,10 +99,6 @@ Global
{294F5209-AD64-4812-AA4E-C7B016927A0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{294F5209-AD64-4812-AA4E-C7B016927A0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{294F5209-AD64-4812-AA4E-C7B016927A0F}.Release|Any CPU.Build.0 = Release|Any CPU
{C05F7B36-EEF7-4BCD-86A2-F5F1BB8CFEB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C05F7B36-EEF7-4BCD-86A2-F5F1BB8CFEB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C05F7B36-EEF7-4BCD-86A2-F5F1BB8CFEB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C05F7B36-EEF7-4BCD-86A2-F5F1BB8CFEB9}.Release|Any CPU.Build.0 = Release|Any CPU
{80DE8673-CB3E-4D0B-99F4-A5CECF6BE752}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{80DE8673-CB3E-4D0B-99F4-A5CECF6BE752}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80DE8673-CB3E-4D0B-99F4-A5CECF6BE752}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
14 changes: 9 additions & 5 deletions dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,29 @@
"version": "4.3.0",
"commands": [
"minver"
]
],
"rollForward": false
},
"assembly-differ": {
"version": "0.14.0",
"commands": [
"assembly-differ"
]
],
"rollForward": false
},
"release-notes": {
"version": "0.5.2",
"commands": [
"release-notes"
]
],
"rollForward": false
},
"nupkg-validator": {
"version": "0.5.0",
"version": "0.7.0",
"commands": [
"nupkg-validator"
]
],
"rollForward": false
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Elastic.Transport" Version="0.4.18" />
<PackageReference Include="Elastic.Transport" Version="0.9.2" />
</ItemGroup>

</Project>
11 changes: 7 additions & 4 deletions examples/Elastic.Ephemeral.Example/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@

var pool = new StaticNodePool(cluster.NodesUris());
var transportConfig = new TransportConfiguration(pool, productRegistration: ElasticsearchProductRegistration.Default)
.Authentication(new BasicAuthentication(Admin.Username, Admin.Password))
.ServerCertificateValidationCallback(CertificateValidations.AllowAll);
if (cluster.DetectedProxy != DetectedProxySoftware.None)
transportConfig = transportConfig.Proxy(new Uri("http://localhost:8080"), null!, null!);
{
Authentication = new BasicAuthentication(Admin.Username, Admin.Password),
ServerCertificateValidationCallback = CertificateValidations.AllowAll,
ProxyAddress = cluster.DetectedProxy == DetectedProxySoftware.None
? null
: "http://localhost:8080"
};

var transport = new DistributedTransport(transportConfig);

Expand Down
10 changes: 5 additions & 5 deletions examples/Elastic.Xunit.ExampleComplex/ClusterTestClassBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
// 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 Elastic.Clients.Elasticsearch;
using Elastic.Elasticsearch.Ephemeral;
using Elastic.Elasticsearch.Xunit.XunitPlumbing;
using Nest;

namespace Elastic.Xunit.ExampleComplex
{
public abstract class ClusterTestClassBase<TCluster> : IClusterFixture<TCluster>
public abstract class ClusterTestClassBase<TCluster>(TCluster cluster)
: IClusterFixture<TCluster>
where TCluster : IEphemeralCluster<EphemeralClusterConfiguration>, IMyCluster, new()
{
protected ClusterTestClassBase(TCluster cluster) => Cluster = cluster;
public TCluster Cluster { get; }
public IElasticClient Client => Cluster.Client;
public TCluster Cluster { get; } = cluster;
public ElasticsearchClient Client => Cluster.Client;
}
}
24 changes: 12 additions & 12 deletions examples/Elastic.Xunit.ExampleComplex/Clusters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,45 @@
// See the LICENSE file in the project root for more information

using System.Collections.Concurrent;
using Elastic.Clients.Elasticsearch;
using Elastic.Elasticsearch.Ephemeral;
using Elastic.Elasticsearch.Xunit;
using Elasticsearch.Net;
using Nest;
using Elastic.Transport;

namespace Elastic.Xunit.ExampleComplex
{
internal static class EphemeralClusterExtensions
{
private static readonly ConcurrentDictionary<IEphemeralCluster, IElasticClient> Clients = new();
private static readonly ConcurrentDictionary<IEphemeralCluster, ElasticsearchClient> Clients = new();

public static IElasticClient GetOrAddClient(this IEphemeralCluster cluster) =>
public static ElasticsearchClient GetOrAddClient(this IEphemeralCluster cluster) =>
Clients.GetOrAdd(cluster, c =>
{
var connectionPool = new StaticConnectionPool(c.NodesUris());
var settings = new ConnectionSettings(connectionPool);
var client = new ElasticClient(settings);
var connectionPool = new StaticNodePool(c.NodesUris());
var settings = new ElasticsearchClientSettings(connectionPool);
var client = new ElasticsearchClient(settings);
return client;
});
}

public interface IMyCluster
{
IElasticClient Client { get; }
ElasticsearchClient Client { get; }
}

public abstract class MyClusterBase() : XunitClusterBase(new XunitClusterConfiguration(MyRunOptions.TestVersion)
{
ShowElasticsearchOutputAfterStarted = false,
}), IMyCluster
{
public IElasticClient Client => this.GetOrAddClient();
public ElasticsearchClient Client => this.GetOrAddClient();
}

public class TestCluster : MyClusterBase
{
protected override void SeedCluster()
{
var pluginsResponse = Client.CatPlugins();
var response = Client.Info();
}
}

Expand All @@ -51,11 +51,11 @@ public TestGenericCluster() : base(new XunitClusterConfiguration(MyRunOptions.Te
{
}

public IElasticClient Client => this.GetOrAddClient();
public ElasticsearchClient Client => this.GetOrAddClient();

protected override void SeedCluster()
{
var aliasesResponse = Client.CatAliases();
var response = Client.Info();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Elastic.Elasticsearch.Ephemeral\Elastic.Elasticsearch.Ephemeral.csproj" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="9.0.4" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />

<PackageReference Include="NEST" Version="6.0.1" />
<PackageReference Include="FluentAssertions" Version="5.1.2" />
<PackageReference Include="FluentAssertions" Version="7.2.0" />
<PackageReference Condition="'$(TargetFramework)' == 'net461'" Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
<ProjectReference Include="..\..\src\Elastic.Elasticsearch.Xunit\Elastic.Elasticsearch.Xunit.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class TestWithoutClusterFixture
public void Test()
{
(1 + 1).Should().Be(2);
var info = ElasticXunitRunner.CurrentCluster.GetOrAddClient().RootNodeInfo();
var info = ElasticXunitRunner.CurrentCluster.GetOrAddClient().Info();
info.Name.Should().NotBeNullOrWhiteSpace();
}
}
Expand Down
33 changes: 13 additions & 20 deletions examples/Elastic.Xunit.ExampleComplex/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,25 @@
// See the LICENSE file in the project root for more information

using Elastic.Elasticsearch.Xunit.XunitPlumbing;
using Elasticsearch.Net;
using FluentAssertions;

namespace Elastic.Xunit.ExampleComplex
{
public class MyTestClass : ClusterTestClassBase<TestCluster>
public class MyTestClass(TestCluster cluster)
: ClusterTestClassBase<TestCluster>(cluster)
{
public MyTestClass(TestCluster cluster) : base(cluster) { }

[I]
public void SomeTest()
{
var info = Client.RootNodeInfo();

info.IsValid.Should().BeTrue();
var info = Client.Info();

Client.CreateIndex("INASda");
Client.LowLevel.Search<StringResponse>(PostData.Serializable(new {query = new {query_string = 1}}));
info.IsValidResponse.Should().BeTrue();
}
}

public class Tests1 : ClusterTestClassBase<TestCluster>
public class Tests1(TestCluster cluster)
: ClusterTestClassBase<TestCluster>(cluster)
{
public Tests1(TestCluster cluster) : base(cluster) { }

[U] public void Unit1Test() => (1 + 1).Should().Be(2);
[U] public void Unit1Test1() => (1 + 1).Should().Be(2);
[U] public void Unit1Test2() => (1 + 1).Should().Be(2);
Expand Down Expand Up @@ -67,9 +61,9 @@ public MyGenericTestClass(TestGenericCluster cluster) : base(cluster) { }

[I] public void SomeTest()
{
var info = Client.RootNodeInfo();
var info = Client.Info();

info.IsValid.Should().BeTrue();
info.IsValidResponse.Should().BeTrue();
}
[U] public void MyGenericUnitTest() => (1 + 1).Should().Be(2);
[U] public void MyGenericUnitTest1() => (1 + 1).Should().Be(2);
Expand All @@ -81,16 +75,15 @@ [I] public void SomeTest()
}

[SkipVersion("<6.2.0", "")]
public class SkipTestClass : ClusterTestClassBase<TestGenericCluster>
public class SkipTestClass(TestGenericCluster cluster)
: ClusterTestClassBase<TestGenericCluster>(cluster)
{
public SkipTestClass(TestGenericCluster cluster) : base(cluster) { }

[I]
public void SomeTest()
{
var info = Client.RootNodeInfo();
var info = Client.Info();

info.IsValid.Should().BeTrue();
info.IsValidResponse.Should().BeTrue();
}

[U]
Expand All @@ -99,7 +92,7 @@ public void SomeTest()

public class DirectInterfaceTests : IClusterFixture<TestGenericCluster>
{
public DirectInterfaceTests(TestGenericCluster cluster) { }
public DirectInterfaceTests(TestGenericCluster _) { }

[U]
public void DirectUnitTest() => (1 + 1).Should().Be(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<IsPackable>False</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="9.0.4" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="NEST" Version="6.0.1" />
<PackageReference Include="FluentAssertions" Version="5.1.2" />
<PackageReference Include="FluentAssertions" Version="7.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Elastic.Elasticsearch.Xunit\Elastic.Elasticsearch.Xunit.csproj" />
Expand Down
16 changes: 8 additions & 8 deletions examples/Elastic.Xunit.ExampleMinimal/ExampleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// 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 Elastic.Clients.Elasticsearch;
using Elastic.Elasticsearch.Xunit;
using Elastic.Elasticsearch.Xunit.XunitPlumbing;
using Elasticsearch.Net;
using Elastic.Transport;
using FluentAssertions;
using Nest;
using Xunit;

// we need to put this assembly attribute in place for xunit to use our custom test execution pipeline
Expand All @@ -21,7 +21,7 @@ public class MyTestCluster : XunitClusterBase
/// We pass our configuration instance to the base class.
/// We only configure it to run version 6.2.3 here but lots of additional options are available.
/// </summary>
public MyTestCluster() : base(new XunitClusterConfiguration("latest-8"))
public MyTestCluster() : base(new XunitClusterConfiguration("latest-9"))
{
}
}
Expand All @@ -40,19 +40,19 @@ public ExampleTest(MyTestCluster cluster) =>
Client = cluster.GetOrAddClient(c =>
{
var nodes = cluster.NodesUris();
var connectionPool = new StaticConnectionPool(nodes);
var settings = new ConnectionSettings(connectionPool)
var connectionPool = new StaticNodePool(nodes);
var settings = new ElasticsearchClientSettings(connectionPool)
.EnableDebugMode();
return new ElasticClient(settings);
return new ElasticsearchClient(settings);
});

private ElasticClient Client { get; }
private ElasticsearchClient Client { get; }

/// <summary> [I] marks an integration test (like [Fact] would for plain Xunit) </summary>
[I]
public void SomeTest()
{
var rootNodeInfo = Client.RootNodeInfo();
var rootNodeInfo = Client.Info();

rootNodeInfo.Name.Should().NotBeNullOrEmpty();
}
Expand Down
Loading