Skip to content

Commit c9b8c1a

Browse files
authored
[Backport master] #5530 Bump testing abstraction and fix cluster run command (#5333)
(cherry picked from commit c8f2b38)
1 parent 04f920e commit c9b8c1a

File tree

8 files changed

+19
-13
lines changed

8 files changed

+19
-13
lines changed

build/scripts/Paths.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module Paths =
1818

1919
let InplaceBuildOutput project tfm =
2020
sprintf "src/%s/bin/Release/%s" project tfm
21-
let InplaceTestOutput project tfm =
21+
let InplaceBuildTestOutput project tfm =
2222
sprintf "tests/%s/bin/Release/%s" project tfm
2323
let MagicDocumentationFile =
2424
"src/Elasticsearch.Net/obj/Release/netstandard2.1/Elasticsearch.Net.csprojAssemblyReference.cache"

build/scripts/ReposTooling.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module ReposTooling =
1515
let clusterName = Option.defaultValue "" <| match args.CommandArguments with | Cluster c -> Some c.Name | _ -> None
1616
let clusterVersion = Option.defaultValue "" <|match args.CommandArguments with | Cluster c -> c.Version | _ -> None
1717

18-
let testsProjectDirectory = Path.GetFullPath(Paths.InplaceTestOutput "Tests.ClusterLauncher" "net5.0")
18+
let testsProjectDirectory = Path.GetFullPath(Paths.InplaceBuildTestOutput "Tests.ClusterLauncher" "net5.0")
1919
let tempDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
2020

2121
printfn "%s" testsProjectDirectory

build/scripts/scripts.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<PackageReference Include="FSharp.Core" Version="5.0.0" />
3939

4040
<PackageReference Include="Bullseye" Version="3.3.0" />
41-
<PackageReference Include="Elastic.Elasticsearch.Managed" Version="0.1.0-canary.0.244" />
41+
<PackageReference Include="Elastic.Elasticsearch.Managed" Version="0.2.5" />
4242

4343
<PackageReference Include="Fake.Core.Environment" Version="5.15.0" />
4444
<PackageReference Include="Fake.Core.SemVer" Version="5.15.0" />

nuget.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<packageSources>
4-
<add key="Elastic Abstractions CI" value="https://ci.appveyor.com/nuget/elasticsearch-net-abstractions" />
54
<add key="Versioned Clients" value="https://ci.appveyor.com/nuget/elasticsearch-net" />
65
</packageSources>
76
</configuration>

tests/Tests.ClusterLauncher/ClusterLaunchProgram.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public static int Main(string[] arguments)
3838
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("NEST_YAML_FILE")))
3939
{
4040
// build always sets previous argument, assume we are running from the IDE or dotnet run
41-
var yamlFile = TestConfiguration.LocateTestYamlFile();
42-
Environment.SetEnvironmentVariable("NEST_YAML_FILE", yamlFile, EnvironmentVariableTarget.Process);
41+
var yamlFile = TestConfiguration.LocateTestYamlFile();
42+
Environment.SetEnvironmentVariable("NEST_YAML_FILE", yamlFile, EnvironmentVariableTarget.Process);
4343
}
4444

4545
// if version is passed this will take precedence over the version in the yaml file
@@ -64,12 +64,19 @@ public static int Main(string[] arguments)
6464
AppDomain.CurrentDomain.ProcessExit += (s, ev) => Instance?.Dispose();
6565
Console.CancelKeyPress += (s, ev) => Instance?.Dispose();
6666

67-
if (!TryStartClientTestClusterBaseImplementation(cluster) && !TryStartXPackClusterImplementation(cluster))
67+
try
6868
{
69+
if (TryStartClientTestClusterBaseImplementation(cluster) || TryStartXPackClusterImplementation(cluster)) return 0;
70+
6971
Console.Error.WriteLine($"Could not create an instance of '{cluster.FullName}");
7072
return 1;
7173
}
72-
return 0;
74+
catch (Exception e)
75+
{
76+
Console.WriteLine(e);
77+
Instance?.Dispose();
78+
throw;
79+
}
7380
}
7481

7582
private static bool TryStartXPackClusterImplementation(Type cluster)
@@ -94,7 +101,7 @@ private static bool TryStartClientTestClusterBaseImplementation(Type cluster)
94101
private static bool Run(ICluster<EphemeralClusterConfiguration> instance)
95102
{
96103
TestConfiguration.Instance.DumpConfiguration();
97-
instance.Start();
104+
using var start = instance.Start();
98105
if (!instance.Started)
99106
{
100107
Console.Error.WriteLine($"Failed to start cluster: '{instance.GetType().FullName}");
@@ -121,7 +128,7 @@ private static Type[] GetClusters()
121128

122129
return types
123130
.Where(t => t.Implements(typeof(IEphemeralCluster)))
124-
.Where(t=> !t.IsAbstract)
131+
.Where(t => !t.IsAbstract)
125132
.ToArray();
126133
}
127134
}

tests/Tests.Configuration/Tests.Configuration.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<TargetFramework>netstandard2.0</TargetFramework>
44
</PropertyGroup>
55
<ItemGroup>
6-
<PackageReference Include="Elastic.Elasticsearch.Managed" Version="0.1.0-canary.0.244" />
6+
<PackageReference Include="Elastic.Elasticsearch.Managed" Version="0.2.5" />
77
</ItemGroup>
88
</Project>

tests/Tests.Core/Tests.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<PackageReference Include="xunit" Version="2.3.1" />
1818
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
19-
<PackageReference Include="Elastic.Elasticsearch.Xunit" Version="0.1.0-canary.0.244" />
19+
<PackageReference Include="Elastic.Elasticsearch.Xunit" Version="0.2.5" />
2020

2121
<PackageReference Include="Nullean.VsTest.Pretty.TestLogger" Version="0.3.0" />
2222
<PackageReference Include="coverlet.collector" Version="1.1.0" />

tests/Tests.Domain/Tests.Domain.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</ItemGroup>
1212
<ItemGroup>
1313
<PackageReference Include="Bogus" Version="22.1.2" />
14-
<PackageReference Include="Elastic.Elasticsearch.Managed" Version="0.1.0-canary.0.244" />
14+
<PackageReference Include="Elastic.Elasticsearch.Managed" Version="0.2.5" />
1515
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
1616
<ProjectReference Include="$(SolutionRoot)\tests\Tests.Configuration\Tests.Configuration.csproj" />
1717
</ItemGroup>

0 commit comments

Comments
 (0)