Skip to content

Commit

Permalink
Update dependencies and configurations (#66)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
Mpdreamz authored Oct 10, 2024
1 parent a83d4f4 commit 34d6e3d
Show file tree
Hide file tree
Showing 18 changed files with 47 additions and 53 deletions.
8 changes: 4 additions & 4 deletions build/scripts/CommandLine.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ with
interface IArgParserTemplate with
member this.Usage =
match this with
| Clean _ -> "clean known output locations"
| Build _ -> "Run build and tests"
| Release _ -> "runs build, and create an validates the packages shy of publishing them"
| Publish _ -> "Runs the full release"
| Clean -> "clean known output locations"
| Build -> "Run build and tests"
| Release -> "runs build, and create an validates the packages shy of publishing them"
| Publish -> "Runs the full release"

| SingleTarget _ -> "Runs the provided sub command without running their dependencies"
| Token _ -> "Token to be used to authenticate with github"
Expand Down
2 changes: 1 addition & 1 deletion examples/Elastic.Ephemeral.Example/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
using HttpMethod = Elastic.Transport.HttpMethod;


var config = new EphemeralClusterConfiguration("8.7.0", XPack | Security | SSL);
var config = new EphemeralClusterConfiguration("8.15.0");
using var cluster = new EphemeralCluster(config);

var exitEvent = new ManualResetEvent(false);
Expand Down
14 changes: 9 additions & 5 deletions examples/Elastic.Managed.Example/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@
// See the LICENSE file in the project root for more information

using System;
using System.IO;
using Elastic.Elasticsearch.Managed;
using Elastic.Elasticsearch.Managed.Configuration;
using Elastic.Elasticsearch.Managed.ConsoleWriters;
using Elastic.Stack.ArtifactsApi;
using Elastic.Stack.ArtifactsApi.Products;

namespace Elastic.Managed.Example
{
public static class Program
{
public static void Main(string[] args)
{
var version = "6.3.0";
var esHome =
Environment.ExpandEnvironmentVariables(
$@"%LOCALAPPDATA%\ElasticManaged\{version}\elasticsearch-{version}");
ElasticVersion version = "latest-8";
var folderName = version.Artifact(Product.Elasticsearch).LocalFolderName;

var clusterConfiguration = new ClusterConfiguration(version, esHome, 2);
var temp = Path.Combine(Path.GetTempPath(), "elastic", folderName, "my-cluster");
var home = Path.Combine(temp, "home");

var clusterConfiguration = new ClusterConfiguration(version, home, 2);
using (var cluster = new ElasticsearchCluster(clusterConfiguration))
cluster.Start(new ConsoleLineWriter(), TimeSpan.FromMinutes(2));

Expand Down
17 changes: 6 additions & 11 deletions examples/Elastic.Xunit.ExampleComplex/Clusters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ namespace Elastic.Xunit.ExampleComplex
{
internal static class EphemeralClusterExtensions
{
private static readonly ConcurrentDictionary<IEphemeralCluster, IElasticClient> Clients =
new ConcurrentDictionary<IEphemeralCluster, IElasticClient>();
private static readonly ConcurrentDictionary<IEphemeralCluster, IElasticClient> Clients = new();

public static IElasticClient GetOrAddClient(this IEphemeralCluster cluster) =>
Clients.GetOrAdd(cluster, (c) =>
Clients.GetOrAdd(cluster, c =>
{
var connectionPool = new StaticConnectionPool(c.NodesUris());
var settings = new ConnectionSettings(connectionPool);
Expand All @@ -30,15 +29,11 @@ public interface IMyCluster
IElasticClient Client { get; }
}

public abstract class MyClusterBase : XunitClusterBase, IMyCluster
public abstract class MyClusterBase() : XunitClusterBase(new XunitClusterConfiguration(MyRunOptions.TestVersion)
{
ShowElasticsearchOutputAfterStarted = false,
}), IMyCluster
{
protected MyClusterBase() : base(new XunitClusterConfiguration(MyRunOptions.TestVersion)
{
ShowElasticsearchOutputAfterStarted = false,
})
{
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Elastic.Elasticsearch.Ephemeral\Elastic.Elasticsearch.Ephemeral.csproj" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<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>
Expand Down
2 changes: 0 additions & 2 deletions examples/Elastic.Xunit.ExampleComplex/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
// 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.Elasticsearch.Managed;
using Elastic.Elasticsearch.Xunit.XunitPlumbing;
using Elasticsearch.Net;
using FluentAssertions;
using Xunit;

namespace Elastic.Xunit.ExampleComplex
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<IsPackable>False</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<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>
Expand Down
2 changes: 1 addition & 1 deletion examples/Elastic.Xunit.ExampleMinimal/ExampleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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-8"))
{
}
}
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.302",
"version": "8.0.100",
"rollForward": "latestFeature",
"allowPrerelease": false
}
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
<PackageReference Include="ConfigureAwaitChecker.Analyzer" Version="4.0.0" PrivateAssets="All" />
<PackageReference Include="ConfigureAwaitChecker.Analyzer" Version="5.0.0.1" PrivateAssets="All" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SharpZipLib.NETStandard" Version="1.0.7" />
<PackageReference Condition="'$(TargetFramework)' == 'net461'" Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Elastic.Elasticsearch.Managed\Elastic.Elasticsearch.Managed.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="System.Net.Http" />
</ItemGroup>
</Project>
8 changes: 2 additions & 6 deletions src/Elastic.Elasticsearch.Managed/ClusterBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,8 @@ public interface ICluster<out TConfiguration> : ICluster,IDisposable
}


public abstract class ClusterBase : ClusterBase<ClusterConfiguration>
{
protected ClusterBase(ClusterConfiguration clusterConfiguration) : base(clusterConfiguration)
{
}
}
public abstract class ClusterBase(ClusterConfiguration clusterConfiguration)
: ClusterBase<ClusterConfiguration>(clusterConfiguration);

public abstract class ClusterBase<TConfiguration> : ICluster<TConfiguration>
where TConfiguration : IClusterConfiguration<NodeFileSystem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Proc" Version="0.6.1" />
<!--<ProjectReference Include="..\..\..\..\proc\src\Proc\Proc.csproj" />-->
<PackageReference Include="System.Net.Http" Version="4.3.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Elastic.Stack.ArtifactsApi\Elastic.Stack.ArtifactsApi.csproj" />
Expand Down
13 changes: 4 additions & 9 deletions src/Elastic.Elasticsearch.Managed/ElasticsearchCluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@

using Elastic.Elasticsearch.Managed.Configuration;

namespace Elastic.Elasticsearch.Managed
{
public class ElasticsearchCluster : ClusterBase
{
public ElasticsearchCluster(ClusterConfiguration clusterConfiguration) : base(clusterConfiguration)
{
}
}
}
namespace Elastic.Elasticsearch.Managed;

public class ElasticsearchCluster(ClusterConfiguration clusterConfiguration)
: ClusterBase(clusterConfiguration);
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nullean.Xunit.Partitions" Version="0.5.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit" Version="2.9.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Elastic.Elasticsearch.Ephemeral\Elastic.Elasticsearch.Ephemeral.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@

<ItemGroup>
<PackageReference Include="SemanticVersioning" Version="1.3.0" />
<PackageReference Include="System.Text.Json" Version="4.6.0" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="System.Net.Http" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace Elastic.Stack.ArtifactsApi.Resolvers
{
public static class SnapshotApiResolver
{
public static readonly System.Lazy<IReadOnlyCollection<Version>> AvailableVersions =
new System.Lazy<IReadOnlyCollection<Version>>(LoadVersions, LazyThreadSafetyMode.ExecutionAndPublication);
public static readonly Lazy<IReadOnlyCollection<Version>> AvailableVersions =
new(LoadVersions, LazyThreadSafetyMode.ExecutionAndPublication);

private static Regex PackageProductRegex { get; } =
new Regex(@"(.*?)-(\d+\.\d+\.\d+(?:-(?:SNAPSHOT|alpha\d+|beta\d+|rc\d+))?)");
Expand Down
2 changes: 1 addition & 1 deletion src/Nest.TypescriptExporter/Nest.TypescriptExporter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
<!--<PackageReference Include="TypeLite" Version="1.1.0" />-->
<Reference Include="TypeLite.dll" />
<PackageReference Include="NEST" Version="7.7.1" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>

0 comments on commit 34d6e3d

Please sign in to comment.