Skip to content

fix #3582 low level client sniffing #3586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/Elasticsearch.Net/Serialization/SimpleJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@

// 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

#define SIMPLE_JSON_TYPEINFO
using System;
using System.CodeDom.Compiler;
using System.Collections;
Expand Down
29 changes: 29 additions & 0 deletions src/Tests/Tests/ClientConcepts/LowLevel/SniffOnLowLevelClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Linq;
using Elastic.Xunit.XunitPlumbing;
using Elasticsearch.Net;
using FluentAssertions;
using Tests.Core.Client.Settings;
using Tests.Core.ManagedElasticsearch.Clusters;
using Tests.Framework;

namespace Tests.ClientConcepts.LowLevel
{
public class SniffOnLowLevelClient : IClusterFixture<ReadOnlyCluster>
{
private readonly ReadOnlyCluster _cluster;

public SniffOnLowLevelClient(ReadOnlyCluster cluster) => _cluster = cluster;

[I] public void CanSniffUsingJustTheLowLevelClient()
{
var uri = TestConnectionSettings.CreateUri(_cluster.Nodes.First().Port ?? 9200);
var sniffingConnectionPool = new SniffingConnectionPool(new[] { uri });
var elasticClient = new ElasticLowLevelClient(new ConnectionConfiguration(sniffingConnectionPool));

Func<DynamicResponse> act = () => elasticClient.ClusterHealth<DynamicResponse>();
act.Invoking(s => s.Invoke()).ShouldNotThrow();
}

}
}