Skip to content

Commit bb1adfa

Browse files
committed
Fix mapping and terms list integration tests
1 parent f15f2d7 commit bb1adfa

File tree

3 files changed

+29
-14
lines changed

3 files changed

+29
-14
lines changed

src/Tests/Framework/Integration/Bootstrappers/Seeder.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using FluentAssertions;
34
using Nest;
45
using Tests.Framework.MockData;
@@ -187,6 +188,9 @@ public static PropertiesDescriptor<Project> ProjectProperties(PropertiesDescript
187188
.Number(n => n
188189
.Name(p => p.NumberOfCommits)
189190
.Store()
191+
)
192+
.Object<Dictionary<string,Metadata>>(o => o
193+
.Name(p => p.Metadata)
190194
);
191195

192196
private static PropertiesDescriptor<Tag> TagProperties(PropertiesDescriptor<Tag> props) => props

src/Tests/Indices/MappingManagement/GetMapping/GetMappingApiTest.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ protected override void ExpectResponse(IGetMappingResponse response)
4444
response.Accept(visitor);
4545

4646
visitor.CountsShouldContainKeyAndCountBe("type", 1);
47-
visitor.CountsShouldContainKeyAndCountBe("object", 2);
47+
visitor.CountsShouldContainKeyAndCountBe("object", 3);
4848
visitor.CountsShouldContainKeyAndCountBe("date", 4);
49-
visitor.CountsShouldContainKeyAndCountBe("string", 17);
49+
visitor.CountsShouldContainKeyAndCountBe("text", 8);
50+
visitor.CountsShouldContainKeyAndCountBe("keyword", 9);
5051
visitor.CountsShouldContainKeyAndCountBe("ip", 1);
5152
visitor.CountsShouldContainKeyAndCountBe("number", 2);
5253
visitor.CountsShouldContainKeyAndCountBe("geo_point", 2);
@@ -151,11 +152,6 @@ public void Visit(BooleanProperty mapping)
151152
Increment("boolean");
152153
}
153154

154-
public void Visit(NumberType mapping)
155-
{
156-
throw new InvalidOperationException("NumberType should never be called");
157-
}
158-
159155
public void Visit(TextProperty mapping)
160156
{
161157
Increment("text");

src/Tests/QueryDsl/TermLevel/Terms/TermsListQueryUsageTests.cs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public TermsListOfListIntegrationTests(ReadOnlyCluster cluster, EndpointUsage us
4646

4747
private List<List<string>> _terms = new List<List<string>> { new List<string> { "term1", "term2" } };
4848

49+
protected override int ExpectStatusCode => 400;
50+
protected override bool ExpectIsValid => false;
51+
4952
protected override object QueryJson => new
5053
{
5154
terms = new
@@ -72,6 +75,18 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
7275
.Terms(_terms)
7376
);
7477

78+
protected override void ExpectResponse(ISearchResponse<Project> response)
79+
{
80+
response.IsValid.Should().BeFalse();
81+
82+
response.ServerError.Should().NotBeNull();
83+
response.ServerError.Status.Should().Be(400);
84+
response.ServerError.Error.Should().NotBeNull();
85+
var rootCauses = response.ServerError.Error.RootCause;
86+
rootCauses.Should().NotBeNullOrEmpty();
87+
var rootCause = rootCauses.First();
88+
rootCause.Type.Should().Be("parsing_exception");
89+
}
7590
}
7691

7792
public class TermsListOfListStringAgainstNumericFieldIntegrationTests : QueryDslIntegrationTestsBase
@@ -110,16 +125,16 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
110125
.Terms(_terms)
111126
);
112127

113-
[I] public Task AsserResponse() => AssertOnAllResponses(r =>
128+
protected override void ExpectResponse(ISearchResponse<Project> response)
114129
{
115-
r.ServerError.Should().NotBeNull();
116-
r.ServerError.Status.Should().Be(400);
117-
r.ServerError.Error.Should().NotBeNull();
118-
var rootCauses = r.ServerError.Error.RootCause;
130+
response.ServerError.Should().NotBeNull();
131+
response.ServerError.Status.Should().Be(400);
132+
response.ServerError.Error.Should().NotBeNull();
133+
var rootCauses = response.ServerError.Error.RootCause;
119134
rootCauses.Should().NotBeNullOrEmpty();
120135
var rootCause = rootCauses.First();
121-
rootCause.Type.Should().Be("number_format_exception");
122-
});
136+
rootCause.Type.Should().Be("parsing_exception");
137+
}
123138

124139
}
125140

0 commit comments

Comments
 (0)