Skip to content

Commit b1080c2

Browse files
committed
Revert "Add tests configuration option to allow skipping of plugin verification"
This reverts commit 3d61c0a.
1 parent c86734d commit b1080c2

File tree

8 files changed

+23
-49
lines changed

8 files changed

+23
-49
lines changed

src/Tests/Framework/Configuration/EnvironmentConfiguration.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public class EnvironmentConfiguration : TestConfigurationBase
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 bool SkipPluginVerification { get; protected set; } = false;
1615

1716
public EnvironmentConfiguration()
1817
{

src/Tests/Framework/Configuration/ITestConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ public interface ITestConfiguration
1010
{
1111
TestMode Mode { get; }
1212
string ElasticsearchVersion { get; }
13-
bool ForceReseed { get; }
13+
bool ForceReseed { get; }
1414
bool DoNotSpawnIfAlreadyRunning { get; }
15-
bool SkipPluginVerification { get; }
15+
1616
bool RunIntegrationTests { get; }
1717
bool RunUnitTests { get; }
1818
}

src/Tests/Framework/Configuration/TestConfigurationBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ public abstract class TestConfigurationBase : ITestConfiguration
1010
{
1111
public abstract bool DoNotSpawnIfAlreadyRunning { get; protected set; }
1212
public abstract string ElasticsearchVersion { get; protected set; }
13-
public abstract bool ForceReseed { get; protected set; }
13+
public abstract bool ForceReseed { get; protected set; }
1414
public abstract TestMode Mode { get; protected set; }
15-
public abstract bool SkipPluginVerification { get; protected set; }
1615

1716
public virtual bool RunIntegrationTests => Mode == TestMode.Mixed || Mode == TestMode.Integration;
1817
public virtual bool RunUnitTests => Mode == TestMode.Mixed || Mode == TestMode.Unit;

src/Tests/Framework/Configuration/YamlConfiguration.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,20 @@ public class YamlConfiguration : TestConfigurationBase
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 bool SkipPluginVerification { get; protected set; } = false;
1413

1514

1615
public YamlConfiguration(string configurationFile)
1716
{
1817
if (!File.Exists(configurationFile)) return;
1918

2019
var config = File.ReadAllLines(configurationFile)
21-
.Where(l=> !string.IsNullOrEmpty(l) && !l.Trim().StartsWith("#"))
20+
.Where(l=>!l.Trim().StartsWith("#"))
2221
.ToDictionary(ConfigName, ConfigValue);
2322

2423
this.Mode = GetTestMode(config["mode"]);
2524
this.ElasticsearchVersion = config["elasticsearch_version"];
2625
this.ForceReseed = bool.Parse(config["force_reseed"]);
2726
this.DoNotSpawnIfAlreadyRunning = bool.Parse(config["do_not_spawn"]);
28-
this.SkipPluginVerification = bool.Parse(config["skip_plugin_verification"]);
2927
}
3028

3129
private static string ConfigName(string configLine) => Parse(configLine, 0);

src/Tests/Framework/Integration/Clusters/ClusterBase.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,13 @@ public abstract class ClusterBase : IIntegrationCluster, IDisposable
1515

1616
protected ClusterBase()
1717
{
18-
var name = this.GetType().Name.Replace("Cluster", "");
19-
20-
this.Node = new ElasticsearchNode(
21-
TestClient.Configuration.ElasticsearchVersion,
22-
TestClient.Configuration.RunIntegrationTests,
23-
DoNotSpawnIfAlreadyRunning,
24-
name,
25-
EnableShield,
26-
TestClient.Configuration.SkipPluginVerification
27-
);
28-
18+
var name = this.GetType().Name.Replace("Cluster", "");
19+
this.Node = new ElasticsearchNode(TestClient.Configuration.ElasticsearchVersion, TestClient.Configuration.RunIntegrationTests, DoNotSpawnIfAlreadyRunning, name, EnableShield);
2920
this.Node.BootstrapWork.Subscribe(handle =>
3021
{
3122
this.Boostrap();
3223
handle.Set();
3324
});
34-
3525
this.ConsoleOut = this.Node.Start(name, this.ServerSettings);
3626
}
3727

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

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public class ElasticsearchNode : IDisposable
3434

3535
private readonly bool _doNotSpawnIfAlreadyRunning;
3636
private readonly bool _shieldEnabled;
37-
private readonly bool _skipPluginVerification;
3837
private ObservableProcess _process;
3938
private IDisposable _processListener;
4039

@@ -104,13 +103,11 @@ public ElasticsearchNode(
104103
bool runningIntegrations,
105104
bool doNotSpawnIfAlreadyRunning,
106105
string name,
107-
bool shieldEnabled,
108-
bool skipPluginVerification
106+
bool shieldEnabled
109107
)
110108
{
111109
this._doNotSpawnIfAlreadyRunning = doNotSpawnIfAlreadyRunning;
112110
this._shieldEnabled = shieldEnabled;
113-
this._skipPluginVerification = skipPluginVerification;
114111

115112
var prefix = name.ToLowerInvariant();
116113
var suffix = Guid.NewGuid().ToString("N").Substring(0, 6);
@@ -215,9 +212,9 @@ public IObservable<ElasticsearchMessage> Start(string typeOfCluster, string[] ad
215212

216213
if (handle.WaitOne(this.HandleTimeout, true)) return observable;
217214

218-
this.Stop();
215+
this.Stop();
219216
throw new Exception($"Could not start elasticsearch within {this.HandleTimeout}");
220-
}
217+
}
221218

222219
#if DOTNETCORE
223220
private IObservable<ElasticsearchMessage> UseAlreadyRunningInstance(Signal handle)
@@ -232,13 +229,11 @@ private IObservable<ElasticsearchMessage> UseAlreadyRunningInstance(ManualResetE
232229

233230
if (!alreadyUp.IsValid) return null;
234231

235-
if (!_skipPluginVerification)
236-
{
237-
var checkPlugins = client.CatPlugins();
238-
var missingPlugins = SupportedPlugins.Keys.Except(checkPlugins.Records.Select(r => r.Component)).ToList();
239-
if (missingPlugins.Any())
240-
throw new Exception($"Already running elasticsearch missed the following plugin(s): {string.Join(", ", missingPlugins)}.");
241-
}
232+
var checkPlugins = client.CatPlugins();
233+
234+
var missingPlugins = SupportedPlugins.Keys.Except(checkPlugins.Records.Select(r => r.Component)).ToList();
235+
if (missingPlugins.Any())
236+
throw new Exception($"Already running elasticsearch missed the following plugin(s): {string.Join(", ", missingPlugins)}.");
242237

243238
this.Started = true;
244239
this.Port = 9200;
@@ -283,6 +278,8 @@ private void ValidateLicense()
283278

284279
if (license.License.Status == LicenseStatus.Invalid)
285280
throw new Exception($"{exceptionMessageStart} but the license is invalid!");
281+
282+
286283
}
287284

288285
#if DOTNETCORE

src/Tests/Framework/MockData/Project.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public class Project
2222
public SimpleGeoPoint Location { get; set; }
2323
public int? NumberOfCommits { get; set; }
2424
public CompletionField Suggest { get; set; }
25-
public IList<string> Branches { get; set; }
2625

2726
public static Faker<Project> Generator { get; } =
2827
new Faker<Project>()

src/Tests/tests.yaml

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
# Dictates what types of tests should be run.
2-
# Can be "u" (unit tests), "i" (integration tests) or "m" (mixed: run both unit and integration tests)
3-
mode: m
4-
5-
# The elasticsearch version that should be started
6-
elasticsearch_version: 5.0.0-alpha2-SNAPSHOT
7-
8-
# Whether we want to forcefully reseed on the node, if you are starting the tests with a node already running
1+
# mode either u (unit test), i (integration test) or m (mixed mode)
2+
mode: u
3+
# the elasticsearch version that should be started
4+
elasticsearch_version: 5.0.0-alpha1
5+
# whether we want to forcefully reseed on the node, if you are starting the tests with a node already running
96
force_reseed: true
10-
11-
# Do not spawn nodes as part of the test setup but instead rely on a manually started ES node being up
12-
do_not_spawn: true
13-
14-
# Skip verification of installed plugins on an already running node.
15-
# Useful for quickly running integration tests that do not rely on any plugins being installed.
16-
skip_plugin_verification: true
7+
# do not spawn nodes as part of the test setup but rely on a manually started es node being up
8+
do_not_spawn: true

0 commit comments

Comments
 (0)