Skip to content
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

[Backport 7.x] Add assigned node to OpenJob/StartDatafeed response #4828

Merged
merged 1 commit into from
Jun 30, 2020
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
8 changes: 8 additions & 0 deletions src/Nest/XPack/MachineLearning/OpenJob/OpenJobResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,13 @@ public class OpenJobResponse : ResponseBase
{
[DataMember(Name ="opened")]
public bool Opened { get; internal set; }

/// <summary>
/// The node that the job was assigned to
/// <para />
/// Available in Elasticsearch 7.8.0+
/// </summary>
[DataMember(Name = "node")]
public string Node { get; internal set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,13 @@ public class StartDatafeedResponse : ResponseBase
{
[DataMember(Name ="started")]
public bool Started { get; internal set; }

/// <summary>
/// The node that the job was assigned to
/// <para />
/// Available in Elasticsearch 7.8.0+
/// </summary>
[DataMember(Name = "node")]
public string Node { get; internal set; }
}
}
10 changes: 9 additions & 1 deletion tests/Tests/XPack/MachineLearning/OpenJob/OpenJobApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Elasticsearch.Net;
using FluentAssertions;
using Nest;
using Tests.Core.Client;
using Tests.Core.Extensions;
using Tests.Framework.EndpointTests.TestState;

namespace Tests.XPack.MachineLearning.OpenJob
Expand Down Expand Up @@ -45,6 +47,12 @@ protected override LazyResponses ClientUsage() => Calls(

protected override OpenJobDescriptor NewDescriptor() => new OpenJobDescriptor(CallIsolatedValue);

protected override void ExpectResponse(OpenJobResponse response) => response.Opened.Should().BeTrue();
protected override void ExpectResponse(OpenJobResponse response)
{
response.Opened.Should().BeTrue();

if (TestClient.Configuration.InRange(">=7.8.0"))
response.Node.Should().NotBeNullOrEmpty();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System;
using System;
using Elasticsearch.Net;
using FluentAssertions;
using Nest;
using Tests.Core.Client;
using Tests.Core.Extensions;
using Tests.Framework.EndpointTests.TestState;

namespace Tests.XPack.MachineLearning.StartDatafeed
Expand Down Expand Up @@ -51,6 +53,12 @@ protected override LazyResponses ClientUsage() => Calls(

protected override StartDatafeedDescriptor NewDescriptor() => new StartDatafeedDescriptor(CallIsolatedValue + "-datafeed");

protected override void ExpectResponse(StartDatafeedResponse response) => response.Started.Should().BeTrue();
protected override void ExpectResponse(StartDatafeedResponse response)
{
response.Started.Should().BeTrue();

if (TestClient.Configuration.InRange(">=7.8.0"))
response.Node.Should().NotBeNullOrEmpty();
}
}
}