Skip to content

Commit 34d6e3d

Browse files
authored
Update dependencies and configurations (#66)
* Update dependencies and configurations Upgraded several package references and configurations across multiple projects to ensure compatibility and performance. Replaced deprecated syntax, optimized namespaces, and enhanced directory structures for better maintainability. * Simplify EphemeralCluster configuration Removed unnecessary commented-out configuration options for clarity. The change ensures the code is more readable and maintainable by using a clean, straightforward cluster configuration.
1 parent a83d4f4 commit 34d6e3d

File tree

18 files changed

+47
-53
lines changed

18 files changed

+47
-53
lines changed

build/scripts/CommandLine.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ with
2727
interface IArgParserTemplate with
2828
member this.Usage =
2929
match this with
30-
| Clean _ -> "clean known output locations"
31-
| Build _ -> "Run build and tests"
32-
| Release _ -> "runs build, and create an validates the packages shy of publishing them"
33-
| Publish _ -> "Runs the full release"
30+
| Clean -> "clean known output locations"
31+
| Build -> "Run build and tests"
32+
| Release -> "runs build, and create an validates the packages shy of publishing them"
33+
| Publish -> "Runs the full release"
3434

3535
| SingleTarget _ -> "Runs the provided sub command without running their dependencies"
3636
| Token _ -> "Token to be used to authenticate with github"

examples/Elastic.Ephemeral.Example/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
using HttpMethod = Elastic.Transport.HttpMethod;
1212

1313

14-
var config = new EphemeralClusterConfiguration("8.7.0", XPack | Security | SSL);
14+
var config = new EphemeralClusterConfiguration("8.15.0");
1515
using var cluster = new EphemeralCluster(config);
1616

1717
var exitEvent = new ManualResetEvent(false);

examples/Elastic.Managed.Example/Program.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,26 @@
33
// See the LICENSE file in the project root for more information
44

55
using System;
6+
using System.IO;
67
using Elastic.Elasticsearch.Managed;
78
using Elastic.Elasticsearch.Managed.Configuration;
89
using Elastic.Elasticsearch.Managed.ConsoleWriters;
10+
using Elastic.Stack.ArtifactsApi;
11+
using Elastic.Stack.ArtifactsApi.Products;
912

1013
namespace Elastic.Managed.Example
1114
{
1215
public static class Program
1316
{
1417
public static void Main(string[] args)
1518
{
16-
var version = "6.3.0";
17-
var esHome =
18-
Environment.ExpandEnvironmentVariables(
19-
$@"%LOCALAPPDATA%\ElasticManaged\{version}\elasticsearch-{version}");
19+
ElasticVersion version = "latest-8";
20+
var folderName = version.Artifact(Product.Elasticsearch).LocalFolderName;
2021

21-
var clusterConfiguration = new ClusterConfiguration(version, esHome, 2);
22+
var temp = Path.Combine(Path.GetTempPath(), "elastic", folderName, "my-cluster");
23+
var home = Path.Combine(temp, "home");
24+
25+
var clusterConfiguration = new ClusterConfiguration(version, home, 2);
2226
using (var cluster = new ElasticsearchCluster(clusterConfiguration))
2327
cluster.Start(new ConsoleLineWriter(), TimeSpan.FromMinutes(2));
2428

examples/Elastic.Xunit.ExampleComplex/Clusters.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ namespace Elastic.Xunit.ExampleComplex
1212
{
1313
internal static class EphemeralClusterExtensions
1414
{
15-
private static readonly ConcurrentDictionary<IEphemeralCluster, IElasticClient> Clients =
16-
new ConcurrentDictionary<IEphemeralCluster, IElasticClient>();
15+
private static readonly ConcurrentDictionary<IEphemeralCluster, IElasticClient> Clients = new();
1716

1817
public static IElasticClient GetOrAddClient(this IEphemeralCluster cluster) =>
19-
Clients.GetOrAdd(cluster, (c) =>
18+
Clients.GetOrAdd(cluster, c =>
2019
{
2120
var connectionPool = new StaticConnectionPool(c.NodesUris());
2221
var settings = new ConnectionSettings(connectionPool);
@@ -30,15 +29,11 @@ public interface IMyCluster
3029
IElasticClient Client { get; }
3130
}
3231

33-
public abstract class MyClusterBase : XunitClusterBase, IMyCluster
32+
public abstract class MyClusterBase() : XunitClusterBase(new XunitClusterConfiguration(MyRunOptions.TestVersion)
33+
{
34+
ShowElasticsearchOutputAfterStarted = false,
35+
}), IMyCluster
3436
{
35-
protected MyClusterBase() : base(new XunitClusterConfiguration(MyRunOptions.TestVersion)
36-
{
37-
ShowElasticsearchOutputAfterStarted = false,
38-
})
39-
{
40-
}
41-
4237
public IElasticClient Client => this.GetOrAddClient();
4338
}
4439

examples/Elastic.Xunit.ExampleComplex/Elastic.Xunit.ExampleComplex.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
</PropertyGroup>
66
<ItemGroup>
77
<ProjectReference Include="..\..\src\Elastic.Elasticsearch.Ephemeral\Elastic.Elasticsearch.Ephemeral.csproj" />
8-
<PackageReference Include="xunit" Version="2.4.1" />
9-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
8+
<PackageReference Include="xunit" Version="2.9.2" />
9+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
1010
<PrivateAssets>all</PrivateAssets>
1111
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1212
</PackageReference>

examples/Elastic.Xunit.ExampleComplex/Tests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information
44

5-
using Elastic.Elasticsearch.Managed;
65
using Elastic.Elasticsearch.Xunit.XunitPlumbing;
76
using Elasticsearch.Net;
87
using FluentAssertions;
9-
using Xunit;
108

119
namespace Elastic.Xunit.ExampleComplex
1210
{

examples/Elastic.Xunit.ExampleMinimal/Elastic.Xunit.ExampleMinimal.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<IsPackable>False</IsPackable>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageReference Include="xunit" Version="2.4.1" />
8-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
7+
<PackageReference Include="xunit" Version="2.9.2" />
8+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
99
<PrivateAssets>all</PrivateAssets>
1010
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1111
</PackageReference>

examples/Elastic.Xunit.ExampleMinimal/ExampleTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class MyTestCluster : XunitClusterBase
2121
/// We pass our configuration instance to the base class.
2222
/// We only configure it to run version 6.2.3 here but lots of additional options are available.
2323
/// </summary>
24-
public MyTestCluster() : base(new XunitClusterConfiguration("latest-8") { })
24+
public MyTestCluster() : base(new XunitClusterConfiguration("latest-8"))
2525
{
2626
}
2727
}

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "6.0.302",
3+
"version": "8.0.100",
44
"rollForward": "latestFeature",
55
"allowPrerelease": false
66
}

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333

3434
<ItemGroup>
3535
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
36-
<PackageReference Include="ConfigureAwaitChecker.Analyzer" Version="4.0.0" PrivateAssets="All" />
36+
<PackageReference Include="ConfigureAwaitChecker.Analyzer" Version="5.0.0.1" PrivateAssets="All" />
3737
</ItemGroup>
3838
</Project>

0 commit comments

Comments
 (0)