Skip to content

Commit 8079f1f

Browse files
committed
Fix tests configuration
1 parent db19acc commit 8079f1f

File tree

11 files changed

+46
-43
lines changed

11 files changed

+46
-43
lines changed

src/Benchmarking/BenchmarkingTestConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static BenchmarkingTestConfiguration()
2424

2525
public override bool ForceReseed { get; protected set; } = true;
2626

27-
public override bool DoNotSpawnIfAlreadyRunning { get; protected set; } = false;
27+
public override bool TestAgainstAlreadyRunningElasticsearch { get; protected set; } = false;
2828

2929
public BenchmarkingTestConfiguration()
3030
: base(YamlConfigurationPath)

src/Profiling/ProfilingTestConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class ProfilingTestConfiguration : YamlConfiguration
66
{
77
public override bool RunIntegrationTests => true;
88

9-
public override bool DoNotSpawnIfAlreadyRunning { get; protected set; } = true;
9+
public override bool TestAgainstAlreadyRunningElasticsearch { get; protected set; } = true;
1010

1111
public ProfilingTestConfiguration()
1212
: base(@"..\..\..\..\Tests\tests.yaml")

src/Tests/Framework/Configuration/EnvironmentConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ namespace Tests.Framework.Configuration
88
{
99
public class EnvironmentConfiguration : TestConfigurationBase
1010
{
11-
public override bool DoNotSpawnIfAlreadyRunning { get; protected set; } = false;
11+
public override bool TestAgainstAlreadyRunningElasticsearch { get; protected set; } = false;
1212
public override bool ForceReseed { get; protected set; } = true;
1313
public override string ElasticsearchVersion { get; protected set; }
1414
public override TestMode Mode { get; protected set; } = TestMode.Unit;
15-
public override string ClusterFilter { get; protected set; }
15+
public override string ClusterFilter { get; protected set; }
1616
public override string TestFilter { get; protected set; }
1717

1818
public EnvironmentConfiguration()

src/Tests/Framework/Configuration/ITestConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public interface ITestConfiguration
1313
string ClusterFilter { get; }
1414
string TestFilter { get; }
1515
bool ForceReseed { get; }
16-
bool DoNotSpawnIfAlreadyRunning { get; }
16+
bool TestAgainstAlreadyRunningElasticsearch { get; }
1717

1818
bool RunIntegrationTests { get; }
1919
bool RunUnitTests { get; }

src/Tests/Framework/Configuration/TestConfigurationBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Tests.Framework.Configuration
88
{
99
public abstract class TestConfigurationBase : ITestConfiguration
1010
{
11-
public abstract bool DoNotSpawnIfAlreadyRunning { get; protected set; }
11+
public abstract bool TestAgainstAlreadyRunningElasticsearch { get; protected set; }
1212
public abstract string ElasticsearchVersion { get; protected set; }
1313
public abstract bool ForceReseed { get; protected set; }
1414
public abstract TestMode Mode { get; protected set; }

src/Tests/Framework/Configuration/YamlConfiguration.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ namespace Tests.Framework.Configuration
66
{
77
public class YamlConfiguration : TestConfigurationBase
88
{
9-
public override bool DoNotSpawnIfAlreadyRunning { get; protected set; } = true;
9+
public override bool TestAgainstAlreadyRunningElasticsearch { get; protected set; } = true;
1010
public override string ElasticsearchVersion { get; protected set; } = "2.0.0";
1111
public override bool ForceReseed { get; protected set; } = true;
1212
public override TestMode Mode { get; protected set; } = TestMode.Unit;
13-
public override string ClusterFilter { get; protected set; }
13+
public override string ClusterFilter { get; protected set; }
1414
public override string TestFilter { get; protected set; }
1515

1616
public YamlConfiguration(string configurationFile)
@@ -24,7 +24,7 @@ public YamlConfiguration(string configurationFile)
2424
this.Mode = GetTestMode(config["mode"]);
2525
this.ElasticsearchVersion = config["elasticsearch_version"];
2626
this.ForceReseed = bool.Parse(config["force_reseed"]);
27-
this.DoNotSpawnIfAlreadyRunning = bool.Parse(config["do_not_spawn"]);
27+
this.TestAgainstAlreadyRunningElasticsearch = bool.Parse(config["test_against_already_running_elasticsearch"]);
2828
this.ClusterFilter = config["cluster_filter"];
2929
this.TestFilter = config.ContainsKey("test_filter") ? config["test_filter"] : null;
3030
}
Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
11
using System;
22
using System.Collections.Specialized;
3-
using System.Threading;
3+
using System.Threading;
44
using Elasticsearch.Net;
55
using Nest;
66

77
namespace Tests.Framework.Integration
88
{
99
public abstract class ClusterBase : IDisposable
1010
{
11-
protected virtual bool DoNotSpawnIfAlreadyRunning => TestClient.Configuration.DoNotSpawnIfAlreadyRunning;
12-
13-
public ElasticsearchNode Node { get; }
14-
11+
protected virtual bool TestAgainstAlreadyRunningElasticsearch => TestClient.Configuration.TestAgainstAlreadyRunningElasticsearch;
12+
13+
public ElasticsearchNode Node { get; }
14+
1515
public IElasticClient Client => this.Node.Client;
1616

17-
protected virtual bool EnableShield => false;
18-
19-
protected virtual bool EnableWatcher => false;
20-
17+
protected virtual bool EnableShield => false;
18+
19+
protected virtual bool EnableWatcher => false;
20+
2121
public virtual int MaxConcurrency => 0;
2222

2323
protected ClusterBase()
2424
{
25-
var name = this.GetType().Name.Replace("Cluster", "");
26-
this.Node = new ElasticsearchNode(
27-
TestClient.Configuration.ElasticsearchVersion,
28-
TestClient.Configuration.RunIntegrationTests,
29-
DoNotSpawnIfAlreadyRunning,
30-
name,
31-
EnableShield,
32-
EnableWatcher);
33-
34-
this.Node.BootstrapWork.Subscribe(handle =>
35-
{
36-
this.Bootstrap();
37-
handle.Set();
38-
});
25+
var name = this.GetType().Name.Replace("Cluster", "");
26+
this.Node = new ElasticsearchNode(
27+
TestClient.Configuration.ElasticsearchVersion,
28+
TestClient.Configuration.RunIntegrationTests,
29+
TestAgainstAlreadyRunningElasticsearch,
30+
name,
31+
EnableShield,
32+
EnableWatcher);
33+
34+
this.Node.BootstrapWork.Subscribe(handle =>
35+
{
36+
this.Bootstrap();
37+
handle.Set();
38+
});
3939
}
4040

41-
public void Start()
42-
{
43-
this.Node.Start(this.ServerSettings);
41+
public void Start()
42+
{
43+
this.Node.Start(this.ServerSettings);
4444
}
4545

4646
protected virtual string[] ServerSettings { get; } = new string[] { };
@@ -50,4 +50,4 @@ public virtual void Bootstrap() { }
5050
public void Dispose() => this.Node?.Dispose();
5151

5252
}
53-
}
53+
}

src/Tests/Framework/Integration/Process/ElasticsearchNode.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class ElasticsearchNode : IDisposable
3535
};
3636
private string[] DefaultNodeSettings { get; }
3737

38-
private readonly bool _doNotSpawnIfAlreadyRunning;
38+
private readonly bool _testAgainstAlreadyRunningElasticsearch;
3939
private readonly bool _shieldEnabled;
4040
private readonly bool _watcherEnabled;
4141
private ObservableProcess _process;
@@ -107,12 +107,12 @@ public bool WaitOne(TimeSpan timeout, bool exitContext)
107107
public ElasticsearchNode(
108108
string elasticsearchVersion,
109109
bool runningIntegrations,
110-
bool doNotSpawnIfAlreadyRunning,
110+
bool testAgainstAlreadyRunningElasticsearch,
111111
string name,
112112
bool shieldEnabled,
113113
bool watcherEnabled)
114114
{
115-
this._doNotSpawnIfAlreadyRunning = doNotSpawnIfAlreadyRunning;
115+
this._testAgainstAlreadyRunningElasticsearch = testAgainstAlreadyRunningElasticsearch;
116116
this._shieldEnabled = shieldEnabled;
117117
this._watcherEnabled = watcherEnabled;
118118

@@ -238,7 +238,7 @@ private IObservable<ElasticsearchMessage> UseAlreadyRunningInstance(Signal handl
238238
private IObservable<ElasticsearchMessage> UseAlreadyRunningInstance(ManualResetEvent handle)
239239
#endif
240240
{
241-
if (!_doNotSpawnIfAlreadyRunning) return null;
241+
if (!_testAgainstAlreadyRunningElasticsearch) return null;
242242

243243
var client = TestClient.Default;
244244
var alreadyUp = client.RootNodeInfo();
@@ -576,7 +576,7 @@ public void Stop(bool disposing = false)
576576

577577
Console.WriteLine($"Node had started on port: {this.Port} cleaning up log/data/repository files...");
578578

579-
if (this._doNotSpawnIfAlreadyRunning) return;
579+
if (this._testAgainstAlreadyRunningElasticsearch) return;
580580
var dataFolder = Path.Combine(this.RoamingClusterFolder, "data", this.ClusterName);
581581
if (Directory.Exists(dataFolder))
582582
{

src/Tests/Framework/Xunit/TestFramework.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ protected override ITestFrameworkExecutor CreateExecutor(AssemblyName assemblyNa
1717
{
1818
var config = TestClient.Configuration;
1919
Console.WriteLine("Starting tests using config:");
20-
Console.WriteLine($" - {nameof(config.DoNotSpawnIfAlreadyRunning)}: {config.DoNotSpawnIfAlreadyRunning}");
20+
Console.WriteLine($" - {nameof(config.TestAgainstAlreadyRunningElasticsearch)}: {config.TestAgainstAlreadyRunningElasticsearch}");
2121
Console.WriteLine($" - {nameof(config.ElasticsearchVersion)}: {config.ElasticsearchVersion}");
2222
Console.WriteLine($" - {nameof(config.ForceReseed)}: {config.ForceReseed}");
2323
Console.WriteLine($" - {nameof(config.Mode)}: {config.Mode.ToString()}");

src/Tests/Tests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,9 @@
707707
<Content Include="ClientConcepts\LowLevel\pipeline.xml" />
708708
<Content Include="QueryDsl\BoolDsl\hadouken-indentation.jpg" />
709709
</ItemGroup>
710+
<ItemGroup>
711+
<Folder Include="Reproduce" />
712+
</ItemGroup>
710713
<Import Project="..\outputpath.props" />
711714
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
712715
<Choose>

0 commit comments

Comments
 (0)