Skip to content

Commit ad6fbcb

Browse files
committed
Fix some failing tests
1 parent d23ad5b commit ad6fbcb

File tree

4 files changed

+64
-8
lines changed

4 files changed

+64
-8
lines changed

src/Tests/Elasticsearch.Net.Integration.Yaml/YamlTestsBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,9 @@ private static bool SerializedJsonEquals(object value, object oo)
363363
{
364364
var json = _client.Serializer.Serialize(value);
365365
var otherJson = _client.Serializer.Serialize(oo);
366-
var nJson = JObject.Parse(Encoding.UTF8.GetString(json)).ToString();
367-
var nOtherJson = JObject.Parse(Encoding.UTF8.GetString(otherJson)).ToString();
368-
Assert.AreEqual(nJson, nOtherJson);
366+
var nJson = JObject.Parse(Encoding.UTF8.GetString(json));
367+
var nOtherJson = JObject.Parse(Encoding.UTF8.GetString(otherJson));
368+
Assert.IsTrue(JToken.DeepEquals(nJson, nOtherJson));
369369
return true;
370370
}
371371
}

src/Tests/Elasticsearch.Net.Integration.Yaml/cluster.reroute/11_explain.yaml.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void ExplainApiForNonExistantNodeShard3Test()
6868
this.Do(()=> _client.ClusterState("master_node"));
6969

7070
//set node_id = _response.master_node;
71-
var node_id = _response.master_node;
71+
string node_id = _response.master_node;
7272

7373
//do cluster.reroute
7474
_body = new {
@@ -77,7 +77,8 @@ public void ExplainApiForNonExistantNodeShard3Test()
7777
cancel= new {
7878
index= "test_index",
7979
shard= "9",
80-
node= node_id
80+
node= node_id,
81+
allow_primary = "false"
8182
}
8283
}
8384
}

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Diagnostics;
34
using System.Linq;
45
using System.Net;
56
using Elasticsearch.Net;
@@ -52,15 +53,23 @@ public void Connect_To_Unknown_Hostname()
5253

5354
//this test will fail if fiddler is enabled since the proxy
5455
//will report a statuscode of 502 instead of -1
55-
Assert.Throws<WebException>(() =>
56+
TestDelegate action = () =>
5657
{
5758
var settings = new ConnectionSettings(new Uri("http://youdontownthis.domain.do.you"), "index");
5859
var client = new ElasticClient(settings);
5960
result = client.RootNodeInfo();
6061
Assert.False(result.IsValid);
6162
Assert.NotNull(result.ConnectionStatus);
62-
});
63-
63+
};
64+
65+
if (Process.GetProcessesByName("fiddler").Any())
66+
{
67+
action();
68+
}
69+
else
70+
{
71+
Assert.Throws<WebException>(action);
72+
}
6473
}
6574
[Test]
6675
public void TestConnectSuccessWithUri()

src/Tests/Nest.Tests.Integration/Reproduce/Reproduce1457Tests.cs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,52 @@ private object BuildAnalysisSettings()
5252
{
5353
return new
5454
{
55+
filter = new {
56+
version_pad2 = new {
57+
pattern = "(\\.|^)(\\d{2})(?=\\.|$)",
58+
type = "pattern_replace",
59+
replacement = "$1000$2"
60+
},
61+
version_pad3 = new {
62+
type = "pattern_replace",
63+
pattern = "(\\.|^)(\\d{3})(?=\\.|$)",
64+
replacement = "$100$2"
65+
},
66+
version_pad1 = new {
67+
pattern = "(\\.|^)(\\d{1})(?=\\.|$)",
68+
type = "pattern_replace",
69+
replacement = "$10000$2"
70+
},
71+
version_pad4 = new {
72+
type = "pattern_replace",
73+
pattern = "(\\.|^)(\\d{4})(?=\\.|$)",
74+
replacement = "$10$2"
75+
},
76+
version = new {
77+
type = "pattern_capture",
78+
patterns = new[] {
79+
"^(\\d+)\\.",
80+
"^(\\d+\\.\\d+)",
81+
"^(\\d+\\.\\d+\\.\\d+)"
82+
}
83+
},
84+
typename = new {
85+
type = "pattern_capture",
86+
patterns = new[] {
87+
"\\.(\\w+)"
88+
}
89+
},
90+
email = new {
91+
type = "pattern_capture",
92+
patterns = new[] {
93+
"(\\w+)",
94+
"(\\p{L}+)",
95+
"(\\d+)",
96+
"(.+)@",
97+
"@(.+)"
98+
}
99+
}
100+
},
55101
analyzer = new
56102
{
57103
comma_whitespace = new

0 commit comments

Comments
 (0)