From 1e8b465fbdab127c5dc672bee23b63b510ebc972 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Thu, 18 Feb 2021 09:52:09 +0100 Subject: [PATCH 1/3] update to latest libs from elastic/elasticsearch-net-abstractions and remove nightlies from nuget.config --- build/scripts/scripts.fsproj | 2 +- nuget.config | 1 - tests/Tests.Configuration/Tests.Configuration.csproj | 2 +- tests/Tests.Core/Tests.Core.csproj | 2 +- tests/Tests.Domain/Tests.Domain.csproj | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/build/scripts/scripts.fsproj b/build/scripts/scripts.fsproj index 30673ae171f..34218b5ca4a 100644 --- a/build/scripts/scripts.fsproj +++ b/build/scripts/scripts.fsproj @@ -38,7 +38,7 @@ - + diff --git a/nuget.config b/nuget.config index 6405b5ef144..8d468146819 100644 --- a/nuget.config +++ b/nuget.config @@ -1,7 +1,6 @@  - \ No newline at end of file diff --git a/tests/Tests.Configuration/Tests.Configuration.csproj b/tests/Tests.Configuration/Tests.Configuration.csproj index 56a5b775972..8dc3dc5bd88 100644 --- a/tests/Tests.Configuration/Tests.Configuration.csproj +++ b/tests/Tests.Configuration/Tests.Configuration.csproj @@ -3,6 +3,6 @@ netstandard2.0 - + \ No newline at end of file diff --git a/tests/Tests.Core/Tests.Core.csproj b/tests/Tests.Core/Tests.Core.csproj index ea0d8f66438..355e97eb938 100644 --- a/tests/Tests.Core/Tests.Core.csproj +++ b/tests/Tests.Core/Tests.Core.csproj @@ -16,7 +16,7 @@ - + diff --git a/tests/Tests.Domain/Tests.Domain.csproj b/tests/Tests.Domain/Tests.Domain.csproj index 846b8d2a702..9091cc6ede0 100644 --- a/tests/Tests.Domain/Tests.Domain.csproj +++ b/tests/Tests.Domain/Tests.Domain.csproj @@ -11,7 +11,7 @@ - + From c8f9e1c8540efde99f7ec2fd760b739588323d02 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Tue, 16 Feb 2021 20:27:38 +0100 Subject: [PATCH 2/3] Update cluster build command so you can run clusters (cherry picked from commit 450f4a92b5f65fbf656697eeea599432637c7e99) --- build/scripts/Paths.fs | 2 ++ build/scripts/ReposTooling.fs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build/scripts/Paths.fs b/build/scripts/Paths.fs index 0f206d90d0f..2ae2badca4d 100644 --- a/build/scripts/Paths.fs +++ b/build/scripts/Paths.fs @@ -18,6 +18,8 @@ module Paths = let InplaceBuildOutput project tfm = sprintf "src/%s/bin/Release/%s" project tfm + let InplaceBuildTestOutput project tfm = + sprintf "tests/%s/bin/Release/%s" project tfm let MagicDocumentationFile = "src/Elasticsearch.Net/obj/Release/netstandard2.1/Elasticsearch.Net.csprojAssemblyReference.cache" diff --git a/build/scripts/ReposTooling.fs b/build/scripts/ReposTooling.fs index 928173f5af3..aa81f9182b9 100644 --- a/build/scripts/ReposTooling.fs +++ b/build/scripts/ReposTooling.fs @@ -15,7 +15,7 @@ module ReposTooling = let clusterName = Option.defaultValue "" <| match args.CommandArguments with | Cluster c -> Some c.Name | _ -> None let clusterVersion = Option.defaultValue "" <|match args.CommandArguments with | Cluster c -> c.Version | _ -> None - let testsProjectDirectory = Path.Combine(Path.GetFullPath(Paths.Output("Tests.ClusterLauncher")), "net5.0") + let testsProjectDirectory = Path.GetFullPath(Paths.InplaceBuildTestOutput "Tests.ClusterLauncher" "net5.0") let tempDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); printfn "%s" testsProjectDirectory From afd7333b3dc29c47d47f1fd333371de29188aa2c Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Thu, 18 Feb 2021 10:58:15 +0100 Subject: [PATCH 3/3] made sure we always dispose on started cluster instance, edge case in seeder prevented it from shutting down (cherry picked from commit b31f119279837b30796ab76b3b2b569d4a2fd62b) --- .../ClusterLaunchProgram.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/Tests.ClusterLauncher/ClusterLaunchProgram.cs b/tests/Tests.ClusterLauncher/ClusterLaunchProgram.cs index d2d4e261767..0d0b5f2d587 100644 --- a/tests/Tests.ClusterLauncher/ClusterLaunchProgram.cs +++ b/tests/Tests.ClusterLauncher/ClusterLaunchProgram.cs @@ -38,8 +38,8 @@ public static int Main(string[] arguments) if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("NEST_YAML_FILE"))) { // build always sets previous argument, assume we are running from the IDE or dotnet run - var yamlFile = TestConfiguration.LocateTestYamlFile(); - Environment.SetEnvironmentVariable("NEST_YAML_FILE", yamlFile, EnvironmentVariableTarget.Process); + var yamlFile = TestConfiguration.LocateTestYamlFile(); + Environment.SetEnvironmentVariable("NEST_YAML_FILE", yamlFile, EnvironmentVariableTarget.Process); } // if version is passed this will take precedence over the version in the yaml file @@ -61,12 +61,19 @@ public static int Main(string[] arguments) AppDomain.CurrentDomain.ProcessExit += (s, ev) => Instance?.Dispose(); Console.CancelKeyPress += (s, ev) => Instance?.Dispose(); - if (!TryStartClientTestClusterBaseImplementation(cluster) && !TryStartXPackClusterImplementation(cluster)) + try { + if (TryStartClientTestClusterBaseImplementation(cluster) || TryStartXPackClusterImplementation(cluster)) return 0; + Console.Error.WriteLine($"Could not create an instance of '{cluster.FullName}"); return 1; } - return 0; + catch (Exception e) + { + Console.WriteLine(e); + Instance?.Dispose(); + throw; + } } private static bool TryStartXPackClusterImplementation(Type cluster) @@ -91,7 +98,7 @@ private static bool TryStartClientTestClusterBaseImplementation(Type cluster) private static bool Run(ICluster instance) { TestConfiguration.Instance.DumpConfiguration(); - instance.Start(); + using var start = instance.Start(); if (!instance.Started) { Console.Error.WriteLine($"Failed to start cluster: '{instance.GetType().FullName}"); @@ -118,7 +125,7 @@ private static Type[] GetClusters() return types .Where(t => t.Implements(typeof(IEphemeralCluster))) - .Where(t=> !t.IsAbstract) + .Where(t => !t.IsAbstract) .ToArray(); } }