Skip to content

Commit 04de292

Browse files
committed
abbendended .Warmup() idea, left tests in to proof that cache hit is once per appdomain and always fast afterwards
1 parent 21d2839 commit 04de292

31 files changed

+243
-307
lines changed

dep/repositories.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<repositories>
33
<repository path="..\src\CodeGeneration\CodeGeneration.LowLevelClient\packages.config" />
44
<repository path="..\src\CodeGeneration\CodeGeneration.YamlTestsRunner\packages.config" />
5-
<repository path="..\src\Connections\Elasticsearch.Net.Connection.HttpClient\packages.config" />
65
<repository path="..\src\Connections\Elasticsearch.Net.Connection.Thrift\packages.config" />
76
<repository path="..\src\Elasticsearch.Net\packages.config" />
87
<repository path="..\src\Nest\packages.config" />

src/Nest/Domain/Connection/ConnectionSettings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ string IConnectionSettingsValues.DefaultIndex
5858
{
5959
get
6060
{
61-
if (this._defaultIndex.IsNullOrEmpty())
62-
throw new NullReferenceException("No default index set on connection!");
61+
//if (this._defaultIndex.IsNullOrEmpty())
62+
// throw new NullReferenceException("No default index set on connection!");
6363
return this._defaultIndex;
6464
}
6565
}

src/Nest/Resolvers/ElasticContractResolver.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ protected override IList<JsonProperty> CreateProperties(Type type, MemberSeriali
9797
defaultProperties = PropertiesOf<IQuery>(type, memberSerialization, defaultProperties, lookup);
9898
defaultProperties = PropertiesOf<IQueryContainer>(type, memberSerialization, defaultProperties, lookup);
9999
defaultProperties = PropertiesOf<IRequest>(type, memberSerialization, defaultProperties, lookup);
100-
//defaultProperties = PropertiesOf<ISearchRequest>(type, memberSerialization, defaultProperties, lookup);
101100
defaultProperties = PropertiesOf<IFilter>(type, memberSerialization, defaultProperties, lookup, append: true);
102101
defaultProperties = PropertiesOf<IFilterContainer>(type, memberSerialization, defaultProperties, lookup);
103102
defaultProperties = PropertiesOf<IRandomScoreFunction>(type, memberSerialization, defaultProperties, lookup);

src/Nest/Resolvers/SettingsContractResolver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public SettingsContractResolver(IContractResolver wrapped, IConnectionSettingsVa
2727
{
2828
this.ConnectionSettings = connectionSettings;
2929
this.Infer = new ElasticInferrer(this.ConnectionSettings);
30-
this._wrapped = wrapped;
30+
this._wrapped = wrapped ?? new DefaultContractResolver();
3131
}
3232

3333
public JsonContract ResolveContract(Type type)

src/Tests/Nest.Tests.Integration/Cluster/HealthTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@ public class HealthTests : IntegrationTests
99
[Test]
1010
public void ClusterHealth()
1111
{
12-
var r = this._client.ClusterHealth(h=>h.Level(Level.Cluster));
12+
var r = this.Client.ClusterHealth(h=>h.Level(Level.Cluster));
1313
Assert.True(r.IsValid);
1414
}
1515
[Test]
1616
public void ClusterHealthPerIndex()
1717
{
18-
var r = this._client.ClusterHealth(h=>h.Index(ElasticsearchConfiguration.DefaultIndex).Level(Level.Cluster));
18+
var r = this.Client.ClusterHealth(h=>h.Index(ElasticsearchConfiguration.DefaultIndex).Level(Level.Cluster));
1919
Assert.True(r.IsValid);
2020
}
2121
[Test]
2222
public void IndexHealth()
2323
{
24-
var r = this._client.ClusterHealth(h=>h.Level(Level.Indices));
24+
var r = this.Client.ClusterHealth(h=>h.Level(Level.Indices));
2525
Assert.True(r.IsValid);
2626
}
2727
[Test]
2828
public void ShardHealth()
2929
{
30-
var r = this._client.ClusterHealth(h=>h.Level(Level.Shards));
30+
var r = this.Client.ClusterHealth(h=>h.Level(Level.Shards));
3131
Assert.True(r.IsValid);
3232
}
3333
[Test]
3434
public void DetailedHealth()
3535
{
36-
var r = this._client.ClusterHealth(h => h
36+
var r = this.Client.ClusterHealth(h => h
3737
.Level(Level.Shards)
3838
.Timeout("30s")
3939
.WaitForNodes("1")
@@ -44,7 +44,7 @@ public void DetailedHealth()
4444
[Test]
4545
public void DetailedHealthPerIndex()
4646
{
47-
var r = this._client.ClusterHealth(h => h
47+
var r = this.Client.ClusterHealth(h => h
4848
.Indices(ElasticsearchConfiguration.DefaultIndex)
4949
.Level(Level.Shards)
5050
.Timeout("30s")

src/Tests/Nest.Tests.Integration/ConnectionTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ public class ConnectionTests : IntegrationTests
1616
public void TestSettings()
1717
{
1818
Assert.AreEqual(ElasticsearchConfiguration.DefaultIndex, ElasticsearchConfiguration.DefaultIndex);
19-
Assert.AreEqual(this._settings.MaximumAsyncConnections, Test.Default.MaximumAsyncConnections);
19+
Assert.AreEqual(this.Settings.MaximumAsyncConnections, ElasticsearchConfiguration.MaxConnections);
2020
}
2121

2222
[Test]
2323
public void TestConnectSuccess()
2424
{
25-
var rootNodeInfo = _client.RootNodeInfo();
25+
var rootNodeInfo = this.Client.RootNodeInfo();
2626
Assert.True(rootNodeInfo.IsValid);
2727
Assert.True(rootNodeInfo.ConnectionStatus.Success);
2828
}
@@ -67,7 +67,7 @@ public void connect_to_unknown_hostname()
6767
[Test]
6868
public void TestConnectSuccessWithUri()
6969
{
70-
var settings = new ConnectionSettings(Test.Default.Uri, "index");
70+
var settings = new ConnectionSettings(ElasticsearchConfiguration.CreateBaseUri(), "index");
7171
var client = new ElasticClient(settings);
7272
var result = client.RootNodeInfo();
7373

@@ -78,12 +78,12 @@ public void TestConnectSuccessWithUri()
7878
[Test]
7979
public void ConnectUsingRawClient()
8080
{
81-
var result = this._client.Raw.Info();
81+
var result = this.Client.Raw.Info();
8282
Assert.IsTrue(result.Success);
8383
StringAssert.EndsWith(":9200/?pretty=true", result.RequestUrl);
8484

8585

86-
var resultWithQueryString = this._client.Raw.Info(qs => qs.AddQueryString("hello", "world"));
86+
var resultWithQueryString = this.Client.Raw.Info(qs => qs.AddQueryString("hello", "world"));
8787
Assert.IsTrue(resultWithQueryString.Success);
8888

8989
StringAssert.EndsWith(":9200/?hello=world&pretty=true", resultWithQueryString.RequestUrl);
@@ -92,7 +92,7 @@ public void ConnectUsingRawClient()
9292
[Test]
9393
public void ConnectUsingRawClientComplexCall()
9494
{
95-
var result = this._client.Raw.ClusterHealth(s => s
95+
var result = this.Client.Raw.ClusterHealth(s => s
9696
.Level(Level.Indices)
9797
.Local(true)
9898
.WaitForActiveShards(1)

src/Tests/Nest.Tests.Integration/Core/Bulk/BulkTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class BulkTests : IntegrationTests
1414
[Test]
1515
public void Bulk()
1616
{
17-
var result = this._client.Bulk(b => b
17+
var result = this.Client.Bulk(b => b
1818
.Index<ElasticsearchProject>(i => i.Document(new ElasticsearchProject {Id = 2}))
1919
.Delete<ElasticsearchProject>(i => i.Document(new ElasticsearchProject { Id = 4 }))
2020
.Create<ElasticsearchProject>(i => i.Document(new ElasticsearchProject { Id = 123123 }))
@@ -32,22 +32,22 @@ public void Bulk()
3232
deleteResponses.Should().HaveCount(1);
3333
deleteResponses.First().Id.Should().BeEquivalentTo("4");
3434
deleteResponses.First().Index.Should().BeEquivalentTo(ElasticsearchConfiguration.DefaultIndex);
35-
deleteResponses.First().Type.Should().BeEquivalentTo(this._client.Infer.TypeName<ElasticsearchProject>());
35+
deleteResponses.First().Type.Should().BeEquivalentTo(this.Client.Infer.TypeName<ElasticsearchProject>());
3636

3737
createResponses.Should().HaveCount(1);
3838
createResponses.First().Id.Should().BeEquivalentTo("123123");
3939
createResponses.First().Index.Should().BeEquivalentTo(ElasticsearchConfiguration.DefaultIndex);
40-
createResponses.First().Type.Should().BeEquivalentTo(this._client.Infer.TypeName<ElasticsearchProject>());
40+
createResponses.First().Type.Should().BeEquivalentTo(this.Client.Infer.TypeName<ElasticsearchProject>());
4141

4242
indexResponses.Should().HaveCount(1);
4343
indexResponses.First().Id.Should().BeEquivalentTo("2");
4444
indexResponses.First().Index.Should().BeEquivalentTo(ElasticsearchConfiguration.DefaultIndex);
45-
indexResponses.First().Type.Should().BeEquivalentTo(this._client.Infer.TypeName<ElasticsearchProject>());
45+
indexResponses.First().Type.Should().BeEquivalentTo(this.Client.Infer.TypeName<ElasticsearchProject>());
4646
}
4747
[Test]
4848
public void DoubleCreateReturnsOneError()
4949
{
50-
var result = this._client.Bulk(b => b
50+
var result = this.Client.Bulk(b => b
5151
.Create<ElasticsearchProject>(i => i.Document(new ElasticsearchProject { Id = 12315555 }))
5252
.Create<ElasticsearchProject>(i => i.Document(new ElasticsearchProject { Id = 12315555 }))
5353
);
@@ -61,7 +61,7 @@ public void DoubleCreateReturnsOneError()
6161
public void BulkWithFixedIndex()
6262
{
6363
var indexName = ElasticsearchConfiguration.NewUniqueIndexName();
64-
var result = this._client.Bulk(b => b
64+
var result = this.Client.Bulk(b => b
6565
.FixedPath(indexName, "mytype")
6666
.Index<ElasticsearchProject>(i => i.Document(new ElasticsearchProject { Id = 2 }))
6767
.Create<ElasticsearchProject>(i => i.Document(new ElasticsearchProject { Id = 3 }))
@@ -97,7 +97,7 @@ public void BulkWithFixedIndexOveriddenIndividualy()
9797
var indexName = ElasticsearchConfiguration.NewUniqueIndexName();
9898
var indexName2 = ElasticsearchConfiguration.NewUniqueIndexName();
9999
var indexName3 = ElasticsearchConfiguration.NewUniqueIndexName();
100-
var result = this._client.Bulk(b => b
100+
var result = this.Client.Bulk(b => b
101101
.FixedPath(indexName, "mytype")
102102
.Index<ElasticsearchProject>(i => i.Document(new ElasticsearchProject { Id = 2 }).Index(indexName2))
103103
.Create<ElasticsearchProject>(i => i.Document(new ElasticsearchProject { Id = 3 }).Type("esproj"))
@@ -135,7 +135,7 @@ public void BulkAlternativeWayOfWriting()
135135
foreach (var i in Enumerable.Range(3000, 1000))
136136
descriptor.Index<ElasticsearchProject>(op => op.Document(new ElasticsearchProject {Id = i}));
137137

138-
var result = this._client.Bulk(d=>descriptor);
138+
var result = this.Client.Bulk(d=>descriptor);
139139
result.Should().NotBeNull();
140140
result.IsValid.Should().BeTrue();
141141
result.Errors.Should().BeFalse();

src/Tests/Nest.Tests.Integration/Core/ClearScroll/ClearScrollTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ public class ClearScrollTests : IntegrationTests
1515
[SkipVersion("1.1.0", "Scroll ids in request body broken in 1.1.0 and fixed in 1.1.1")]
1616
public void ClearScroll()
1717
{
18-
var searchResults = this._client.Search<ElasticsearchProject>(s => s.Scroll("1m").SearchType(SearchType.Scan));
18+
var searchResults = this.Client.Search<ElasticsearchProject>(s => s.Scroll("1m").SearchType(SearchType.Scan));
1919
var validScrollId = searchResults.ScrollId;
2020
validScrollId.Should().NotBeNullOrWhiteSpace();
2121

22-
var clearResponse = this._client.ClearScroll(cs => cs.ScrollId(validScrollId));
22+
var clearResponse = this.Client.ClearScroll(cs => cs.ScrollId(validScrollId));
2323
clearResponse.IsValid.Should().BeTrue();
2424

25-
var bogusClearResponse = this._client.ClearScroll(cs => cs.ScrollId("asdasdadasdasd"));
25+
var bogusClearResponse = this.Client.ClearScroll(cs => cs.ScrollId("asdasdadasdasd"));
2626
bogusClearResponse.IsValid.Should().BeFalse();
2727
}
2828

0 commit comments

Comments
 (0)