Skip to content

Commit 37be7cd

Browse files
MpdreamzSukharevAndrey
authored andcommitted
fix elastic#3582 elastic#3483 introduced SIMPLE_JSON_TYPEDEF to be defined which caused netstandard and netfx exceptions when deserializing sniff responses, but would light up in different places as well (elastic#3586)
(cherry picked from commit 0c5c092)
1 parent 3a317cf commit 37be7cd

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/Elasticsearch.Net/Serialization/SimpleJson.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848

4949
// original json parsing code from http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
5050

51-
#define SIMPLE_JSON_TYPEINFO
5251
using System;
5352
using System.CodeDom.Compiler;
5453
using System.Collections;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System;
2+
using System.Linq;
3+
using Elastic.Xunit.XunitPlumbing;
4+
using Elasticsearch.Net;
5+
using FluentAssertions;
6+
using Tests.Core.Client.Settings;
7+
using Tests.Core.ManagedElasticsearch.Clusters;
8+
using Tests.Framework;
9+
10+
namespace Tests.ClientConcepts.LowLevel
11+
{
12+
public class SniffOnLowLevelClient : IClusterFixture<ReadOnlyCluster>
13+
{
14+
private readonly ReadOnlyCluster _cluster;
15+
16+
public SniffOnLowLevelClient(ReadOnlyCluster cluster) => _cluster = cluster;
17+
18+
[I] public void CanSniffUsingJustTheLowLevelClient()
19+
{
20+
var uri = TestConnectionSettings.CreateUri(_cluster.Nodes.First().Port ?? 9200);
21+
var sniffingConnectionPool = new SniffingConnectionPool(new[] { uri });
22+
var elasticClient = new ElasticLowLevelClient(new ConnectionConfiguration(sniffingConnectionPool));
23+
24+
Func<DynamicResponse> act = () => elasticClient.ClusterHealth<DynamicResponse>();
25+
act.Invoking(s => s.Invoke()).ShouldNotThrow();
26+
}
27+
28+
}
29+
}

0 commit comments

Comments
 (0)