Skip to content

Commit a247af8

Browse files
committed
ElasticsearchVersion on Tests.Configuration is now ElasticVersion not string
1 parent 426087c commit a247af8

File tree

7 files changed

+11
-9
lines changed

7 files changed

+11
-9
lines changed

src/Tests/Tests.Configuration/EnvironmentConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public EnvironmentConfiguration(YamlConfiguration yamlConfiguration)
1313

1414
var version = Environment.GetEnvironmentVariable("NEST_INTEGRATION_VERSION");
1515
ElasticsearchVersion = string.IsNullOrWhiteSpace(version) ? yamlConfiguration.ElasticsearchVersion : version;
16-
if (string.IsNullOrWhiteSpace(ElasticsearchVersion))
16+
if (ElasticsearchVersion == null)
1717
throw new Exception("Elasticsearch Version could not be determined from env var NEST_INTEGRATION_VERSION nor the test yaml configuration");
1818

1919
var externalSeed = TryGetEnv("NEST_TEST_SEED", out var seed)

src/Tests/Tests.Configuration/TestConfigurationBase.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using Elastic.Stack.Artifacts;
23

34
namespace Tests.Configuration
45
{
@@ -11,10 +12,9 @@ public abstract class TestConfigurationBase
1112
public string TestFilter { get; protected set; }
1213

1314
/// <summary> The Elasticsearch version to test against, defined for both unit and integration tests</summary>
14-
public string ElasticsearchVersion { get; protected set; }
15+
public ElasticVersion ElasticsearchVersion { get; protected set; }
1516

16-
public bool ElasticsearchVersionIsSnapshot => !string.IsNullOrWhiteSpace(ElasticsearchVersion)
17-
&& (ElasticsearchVersion.Contains("SNAPSHOT") || ElasticsearchVersion.Contains("latest"));
17+
public bool ElasticsearchVersionIsSnapshot => ElasticsearchVersion.ArtifactBuildState == ArtifactBuildState.Snapshot;
1818

1919
/// <summary> Force a reseed (bootstrap) of the cluster even if checks indicate bootstrap already ran </summary>
2020
public bool ForceReseed { get; protected set; }
@@ -69,7 +69,7 @@ public class RandomConfiguration
6969

7070
/// <summary> Randomly enable typed keys on searches (defaults to true) on NEST search requests</summary>
7171
public bool TypedKeys { get; set; }
72-
72+
7373
/// <summary> Randomly enable compression on the http requests</summary>
7474
public bool HttpCompression { get; set; }
7575
}

src/Tests/Tests.Configuration/Tests.Configuration.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@
33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
55
</PropertyGroup>
6+
<ItemGroup>
7+
<PackageReference Include="Elastic.Managed" Version="0.1.0-ci20191017T152836" />
8+
</ItemGroup>
69
</Project>

src/Tests/Tests.Core/Extensions/TestConfigurationExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ public static IConnection CreateConnection(this TestConfigurationBase configurat
1111
configuration.RunIntegrationTests && !forceInMemory ? (IConnection)new HttpConnection() : new InMemoryConnection();
1212

1313
public static bool InRange(this TestConfigurationBase configuration, string range) =>
14-
ElasticVersion.From(configuration.ElasticsearchVersion).InRange(range);
14+
configuration.ElasticsearchVersion.InRange(range);
1515
}
1616
}

src/Tests/Tests.Core/ManagedElasticsearch/Clusters/WritableCluster.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ private static ClientTestClusterConfiguration CreateConfiguration()
3030
};
3131

3232
// TODO: temporary until https://github.com/elastic/elasticsearch-net-abstractions/commit/3977ccb6449870fb4f1e6059be960e12ec5e5125 is released
33-
if (ElasticVersion.From(TestClient.Configuration.ElasticsearchVersion) >= "6.4.0")
33+
if (TestClient.Configuration.ElasticsearchVersion >= "6.4.0")
3434
plugins.Add(new ElasticsearchPlugin("analysis-nori", v => v >= "6.4.0"));
3535

3636
return new ClientTestClusterConfiguration(plugins.ToArray())

src/Tests/Tests.Domain/Helpers/TestValueHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static class TestValueHelper
1313

1414
public static string PercolatorType => InRange("<5.0.0-alpha1") ? ".percolator" : "query";
1515

16-
private static bool InRange(string range) => ElasticVersion.From(TestConfiguration.Instance.ElasticsearchVersion).InRange(range);
16+
private static bool InRange(string range) => TestConfiguration.Instance.ElasticsearchVersion.InRange(range);
1717

1818
public static object Dependant(object builtin, object source) => TestConfiguration.Instance.Random.SourceSerializer ? source : builtin;
1919
}

src/Tests/Tests.Domain/Tests.Domain.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
</ItemGroup>
1313
<ItemGroup>
1414
<PackageReference Include="Bogus" Version="22.1.2" />
15-
<PackageReference Include="Elastic.Managed" Version="0.1.0-ci20191017T152836" />
1615
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
1716
<ProjectReference Include="..\Tests.Configuration\Tests.Configuration.csproj" />
1817
</ItemGroup>

0 commit comments

Comments
 (0)