Skip to content

Commit 3c5959f

Browse files
authored
Merge pull request #2175 from elastic/fix/2173
Fix IsValid logic error in UpdateByQuery response
2 parents fd21d31 + 3f77571 commit 3c5959f

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

src/Nest/Document/Multiple/UpdateByQuery/UpdateByQueryResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public interface IUpdateByQueryResponse : IResponse
4141

4242
public class UpdateByQueryResponse : ResponseBase, IUpdateByQueryResponse
4343
{
44-
public override bool IsValid => this.ApiCall?.HttpStatusCode == 200 || !this.Failures.HasAny();
44+
public override bool IsValid => this.ApiCall?.HttpStatusCode == 200 && !this.Failures.HasAny();
4545

4646
public long Took { get; internal set; }
4747

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using FluentAssertions;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using Tests.Framework;
8+
using Tests.Framework.MockData;
9+
10+
namespace Tests.Reproduce
11+
{
12+
public class GithubIssue2173
13+
{
14+
[I]
15+
public void UpdateByQueryWithInvalidScript()
16+
{
17+
var client = TestClient.GetClient();
18+
var response = client.UpdateByQuery<Project>(typeof(Project), typeof(Project), u => u
19+
.Script("invalid groovy")
20+
);
21+
response.IsValid.Should().BeFalse();
22+
}
23+
}
24+
}

src/Tests/Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@
570570
<Compile Include="Reproduce\GithubIssue2101.cs" />
571571
<Compile Include="Reproduce\GithubIssue2152.cs" />
572572
<Compile Include="Reproduce\GithubIssue2052.cs" />
573+
<Compile Include="Reproduce\GithubIssue2173.cs" />
573574
<Compile Include="Search\Search\Rescoring\RescoreUsageTests.cs" />
574575
<Compile Include="XPack\Security\ClearCachedRealms\ClearCachedRealmsApiTests.cs" />
575576
<Compile Include="XPack\Security\ClearCachedRealms\ClearCachedRealmsUrlTests.cs" />

src/Tests/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# mode either u (unit test), i (integration test) or m (mixed mode)
2-
mode: u
2+
mode: i
33
# the elasticsearch version that should be started
44
elasticsearch_version: 2.3.4
55
# whether we want to forcefully reseed on the node, if you are starting the tests with a node already running

0 commit comments

Comments
 (0)