Skip to content

Commit

Permalink
Add assigned node to OpenJob/StartDatafeed response (#4815) (#4828)
Browse files Browse the repository at this point in the history
Relates: elastic/elasticsearch#55473, #4803

Co-authored-by: Russ Cam <[email protected]>
  • Loading branch information
github-actions[bot] and russcam authored Jun 30, 2020
1 parent f09c19a commit f2d0139
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
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();
}
}
}

0 comments on commit f2d0139

Please sign in to comment.