Skip to content

Commit a5cd537

Browse files
Fixes integration tests against latest 7.7.0-SNAPSHOT (#4545) (#4548)
- Change date histogram aggregations to use minimum document = 0 in order to pass server validation. - Changes terms query to use a string value to pass server validation - Change search template API test to not tie to a specific server message substring Fixes #4521 Fixes #4508 Co-authored-by: Stuart Cam <stuart.cam@elastic.co>
1 parent eacd46c commit a5cd537

10 files changed

+29
-27
lines changed

tests/Tests/Aggregations/Pipeline/Derivative/DerivativeAggregationUsageTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public DerivativeAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsage us
2121
{
2222
field = "startedOn",
2323
interval = "month",
24-
min_doc_count = 1
24+
min_doc_count = 0
2525
},
2626
aggs = new
2727
{
@@ -48,7 +48,7 @@ public DerivativeAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsage us
4848
.DateHistogram("projects_started_per_month", dh => dh
4949
.Field(p => p.StartedOn)
5050
.Interval(DateInterval.Month)
51-
.MinimumDocumentCount(1)
51+
.MinimumDocumentCount(0)
5252
.Aggregations(aa => aa
5353
.Sum("commits", sm => sm
5454
.Field(p => p.NumberOfCommits)
@@ -64,7 +64,7 @@ public DerivativeAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsage us
6464
{
6565
Field = "startedOn",
6666
Interval = DateInterval.Month,
67-
MinimumDocumentCount = 1,
67+
MinimumDocumentCount = 0,
6868
Aggregations =
6969
new SumAggregation("commits", "numberOfCommits") &&
7070
new DerivativeAggregation("commits_derivative", "commits")

tests/Tests/Aggregations/Pipeline/MovingAverage/MovingAverageEwmaAggregationUsageTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public MovingAverageEwmaAggregationUsageTests(ReadOnlyCluster cluster, EndpointU
2323
{
2424
field = "startedOn",
2525
interval = "month",
26-
min_doc_count = 1
26+
min_doc_count = 0
2727
},
2828
aggs = new
2929
{
@@ -55,7 +55,7 @@ public MovingAverageEwmaAggregationUsageTests(ReadOnlyCluster cluster, EndpointU
5555
.DateHistogram("projects_started_per_month", dh => dh
5656
.Field(p => p.StartedOn)
5757
.Interval(DateInterval.Month)
58-
.MinimumDocumentCount(1)
58+
.MinimumDocumentCount(0)
5959
.Aggregations(aa => aa
6060
.Sum("commits", sm => sm
6161
.Field(p => p.NumberOfCommits)
@@ -76,7 +76,7 @@ public MovingAverageEwmaAggregationUsageTests(ReadOnlyCluster cluster, EndpointU
7676
{
7777
Field = "startedOn",
7878
Interval = DateInterval.Month,
79-
MinimumDocumentCount = 1,
79+
MinimumDocumentCount = 0,
8080
Aggregations =
8181
new SumAggregation("commits", "numberOfCommits")
8282
&& new MovingAverageAggregation("commits_moving_avg", "commits")

tests/Tests/Aggregations/Pipeline/MovingAverage/MovingAverageHoltLinearAggregationUsageTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public MovingAverageHoltLinearAggregationUsageTests(ReadOnlyCluster cluster, End
2323
{
2424
field = "startedOn",
2525
interval = "month",
26-
min_doc_count = 1
26+
min_doc_count = 0
2727
},
2828
aggs = new
2929
{
@@ -56,7 +56,7 @@ public MovingAverageHoltLinearAggregationUsageTests(ReadOnlyCluster cluster, End
5656
.DateHistogram("projects_started_per_month", dh => dh
5757
.Field(p => p.StartedOn)
5858
.Interval(DateInterval.Month)
59-
.MinimumDocumentCount(1)
59+
.MinimumDocumentCount(0)
6060
.Aggregations(aa => aa
6161
.Sum("commits", sm => sm.Field(p => p.NumberOfCommits))
6262
.MovingAverage("commits_moving_avg", mv => mv
@@ -76,7 +76,7 @@ public MovingAverageHoltLinearAggregationUsageTests(ReadOnlyCluster cluster, End
7676
{
7777
Field = "startedOn",
7878
Interval = DateInterval.Month,
79-
MinimumDocumentCount = 1,
79+
MinimumDocumentCount = 0,
8080
Aggregations =
8181
new SumAggregation("commits", "numberOfCommits")
8282
&& new MovingAverageAggregation("commits_moving_avg", "commits")

tests/Tests/Aggregations/Pipeline/MovingAverage/MovingAverageHoltWintersAggregationUsageTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public MovingAverageHoltWintersUsageTests(ReadOnlyCluster cluster, EndpointUsage
2222
{
2323
field = "startedOn",
2424
interval = "month",
25-
min_doc_count = 1
25+
min_doc_count = 0
2626
},
2727
aggs = new
2828
{
@@ -60,7 +60,7 @@ public MovingAverageHoltWintersUsageTests(ReadOnlyCluster cluster, EndpointUsage
6060
.DateHistogram("projects_started_per_month", dh => dh
6161
.Field(p => p.StartedOn)
6262
.Interval(DateInterval.Month)
63-
.MinimumDocumentCount(1)
63+
.MinimumDocumentCount(0)
6464
.Aggregations(aa => aa
6565
.Sum("commits", sm => sm
6666
.Field(p => p.NumberOfCommits)
@@ -87,7 +87,7 @@ public MovingAverageHoltWintersUsageTests(ReadOnlyCluster cluster, EndpointUsage
8787
{
8888
Field = "startedOn",
8989
Interval = DateInterval.Month,
90-
MinimumDocumentCount = 1,
90+
MinimumDocumentCount = 0,
9191
Aggregations =
9292
new SumAggregation("commits", "numberOfCommits")
9393
&& new MovingAverageAggregation("commits_moving_avg", "commits")

tests/Tests/Aggregations/Pipeline/MovingAverage/MovingAverageLinearAggregationUsageTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public MovingAverageLinearAggregationUsageTests(ReadOnlyCluster cluster, Endpoin
2323
{
2424
field = "startedOn",
2525
interval = "month",
26+
min_doc_count = 0
2627
},
2728
aggs = new
2829
{
@@ -52,6 +53,7 @@ public MovingAverageLinearAggregationUsageTests(ReadOnlyCluster cluster, Endpoin
5253
.DateHistogram("projects_started_per_month", dh => dh
5354
.Field(p => p.StartedOn)
5455
.Interval(DateInterval.Month)
56+
.MinimumDocumentCount(0)
5557
.Aggregations(aa => aa
5658
.Sum("commits", sm => sm
5759
.Field(p => p.NumberOfCommits)
@@ -71,6 +73,7 @@ public MovingAverageLinearAggregationUsageTests(ReadOnlyCluster cluster, Endpoin
7173
{
7274
Field = "startedOn",
7375
Interval = DateInterval.Month,
76+
MinimumDocumentCount = 0,
7477
Aggregations =
7578
new SumAggregation("commits", "numberOfCommits") &&
7679
new MovingAverageAggregation("commits_moving_avg", "commits")

tests/Tests/Aggregations/Pipeline/MovingAverage/MovingAverageSimpleAggregationUsageTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ public MovingAverageSimpleAggregationUsageTests(ReadOnlyCluster cluster, Endpoin
2222
date_histogram = new
2323
{
2424
field = "startedOn",
25-
interval = "month"
25+
interval = "month",
26+
min_doc_count = 0
2627
},
2728
aggs = new
2829
{
@@ -54,6 +55,7 @@ public MovingAverageSimpleAggregationUsageTests(ReadOnlyCluster cluster, Endpoin
5455
.DateHistogram("projects_started_per_month", dh => dh
5556
.Field(p => p.StartedOn)
5657
.Interval(DateInterval.Month)
58+
.MinimumDocumentCount(0)
5759
.Aggregations(aa => aa
5860
.Sum("commits", sm => sm
5961
.Field(p => p.NumberOfCommits)
@@ -75,6 +77,7 @@ public MovingAverageSimpleAggregationUsageTests(ReadOnlyCluster cluster, Endpoin
7577
{
7678
Field = "startedOn",
7779
Interval = DateInterval.Month,
80+
MinimumDocumentCount = 0,
7881
Aggregations =
7982
new SumAggregation("commits", "numberOfCommits")
8083
&& new MovingAverageAggregation("commits_moving_avg", "commits")

tests/Tests/Aggregations/Pipeline/MovingFunction/MovingFunctionAggregationUsageTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public MovingFunctionAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsag
3434
{
3535
field = "startedOn",
3636
interval = "month",
37+
min_doc_count = 0
3738
},
3839
aggs = new
3940
{
@@ -63,6 +64,7 @@ public MovingFunctionAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsag
6364
.DateHistogram("projects_started_per_month", dh => dh
6465
.Field(p => p.StartedOn)
6566
.Interval(DateInterval.Month)
67+
.MinimumDocumentCount(0)
6668
.Aggregations(aa => aa
6769
.Sum("commits", sm => sm
6870
.Field(p => p.NumberOfCommits)
@@ -81,6 +83,7 @@ public MovingFunctionAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsag
8183
{
8284
Field = "startedOn",
8385
Interval = DateInterval.Month,
86+
MinimumDocumentCount = 0,
8487
Aggregations =
8588
new SumAggregation("commits", "numberOfCommits")
8689
&& new MovingFunctionAggregation("commits_moving_avg", "commits")

tests/Tests/Aggregations/Pipeline/SerialDifferencing/SerialDifferencingAggregationUsageTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public SerialDifferencingAggregationUsageTests(ReadOnlyCluster cluster, Endpoint
2020
{
2121
field = "startedOn",
2222
interval = "month",
23-
min_doc_count = 1
23+
min_doc_count = 0
2424
},
2525
aggs = new
2626
{
@@ -48,7 +48,7 @@ public SerialDifferencingAggregationUsageTests(ReadOnlyCluster cluster, Endpoint
4848
.DateHistogram("projects_started_per_month", dh => dh
4949
.Field(p => p.StartedOn)
5050
.Interval(DateInterval.Month)
51-
.MinimumDocumentCount(1)
51+
.MinimumDocumentCount(0)
5252
.Aggregations(aa => aa
5353
.Sum("commits", sm => sm
5454
.Field(p => p.NumberOfCommits)
@@ -65,7 +65,7 @@ public SerialDifferencingAggregationUsageTests(ReadOnlyCluster cluster, Endpoint
6565
{
6666
Field = "startedOn",
6767
Interval = DateInterval.Month,
68-
MinimumDocumentCount = 1,
68+
MinimumDocumentCount = 0,
6969
Aggregations =
7070
new SumAggregation("commits", "numberOfCommits")
7171
&& new SerialDifferencingAggregation("second_difference", "commits")

tests/Tests/QueryDsl/TermLevel/Terms/TermsLookupQueryUsageTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public TermsLookupQueryUsageTests(ReadOnlyCluster cluster, EndpointUsage usage)
2626
Field = "description",
2727
TermsLookup = new FieldLookup
2828
{
29-
Id = 12,
29+
Id = "12",
3030
Index = Index<Developer>(),
3131
Path = Field<Developer>(p => p.LastName),
3232
Routing = "myroutingvalue"
@@ -41,7 +41,7 @@ public TermsLookupQueryUsageTests(ReadOnlyCluster cluster, EndpointUsage usage)
4141
boost = 1.1,
4242
description = new
4343
{
44-
id = 12,
44+
id = "12",
4545
index = "devs",
4646
path = "lastName",
4747
routing = "myroutingvalue"
@@ -56,7 +56,7 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
5656
.Field(p => p.Description)
5757
.TermsLookup<Developer>(e => e
5858
.Path(p => p.LastName)
59-
.Id(12)
59+
.Id("12")
6060
.Routing("myroutingvalue")
6161
)
6262
);

tests/Tests/Search/SearchTemplate/SearchTemplateApiTests.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,6 @@ protected override LazyResponses ClientUsage() => Calls(
101101
(c, r) => c.SearchTemplateAsync<Project>(r)
102102
);
103103

104-
protected override void ExpectResponse(ISearchResponse<Project> response)
105-
{
106-
response.ServerError.Should().NotBeNull();
107-
if (TestConfiguration.Instance.ElasticsearchVersion < "7.7.0")
108-
response.ServerError.Error.Reason.Should().Contain("no [query]");
109-
else
110-
response.ServerError.Error.Reason.Should().Contain("unknown query [atch]");
111-
}
104+
protected override void ExpectResponse(ISearchResponse<Project> response) => response.ServerError.Should().NotBeNull();
112105
}
113106
}

0 commit comments

Comments
 (0)