Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public DerivativeAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsage us
{
field = "startedOn",
interval = "month",
min_doc_count = 1
min_doc_count = 0
},
aggs = new
{
Expand All @@ -48,7 +48,7 @@ public DerivativeAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsage us
.DateHistogram("projects_started_per_month", dh => dh
.Field(p => p.StartedOn)
.Interval(DateInterval.Month)
.MinimumDocumentCount(1)
.MinimumDocumentCount(0)
.Aggregations(aa => aa
.Sum("commits", sm => sm
.Field(p => p.NumberOfCommits)
Expand All @@ -64,7 +64,7 @@ public DerivativeAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsage us
{
Field = "startedOn",
Interval = DateInterval.Month,
MinimumDocumentCount = 1,
MinimumDocumentCount = 0,
Aggregations =
new SumAggregation("commits", "numberOfCommits") &&
new DerivativeAggregation("commits_derivative", "commits")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public MovingAverageEwmaAggregationUsageTests(ReadOnlyCluster cluster, EndpointU
{
field = "startedOn",
interval = "month",
min_doc_count = 1
min_doc_count = 0
},
aggs = new
{
Expand Down Expand Up @@ -55,7 +55,7 @@ public MovingAverageEwmaAggregationUsageTests(ReadOnlyCluster cluster, EndpointU
.DateHistogram("projects_started_per_month", dh => dh
.Field(p => p.StartedOn)
.Interval(DateInterval.Month)
.MinimumDocumentCount(1)
.MinimumDocumentCount(0)
.Aggregations(aa => aa
.Sum("commits", sm => sm
.Field(p => p.NumberOfCommits)
Expand All @@ -76,7 +76,7 @@ public MovingAverageEwmaAggregationUsageTests(ReadOnlyCluster cluster, EndpointU
{
Field = "startedOn",
Interval = DateInterval.Month,
MinimumDocumentCount = 1,
MinimumDocumentCount = 0,
Aggregations =
new SumAggregation("commits", "numberOfCommits")
&& new MovingAverageAggregation("commits_moving_avg", "commits")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public MovingAverageHoltLinearAggregationUsageTests(ReadOnlyCluster cluster, End
{
field = "startedOn",
interval = "month",
min_doc_count = 1
min_doc_count = 0
},
aggs = new
{
Expand Down Expand Up @@ -56,7 +56,7 @@ public MovingAverageHoltLinearAggregationUsageTests(ReadOnlyCluster cluster, End
.DateHistogram("projects_started_per_month", dh => dh
.Field(p => p.StartedOn)
.Interval(DateInterval.Month)
.MinimumDocumentCount(1)
.MinimumDocumentCount(0)
.Aggregations(aa => aa
.Sum("commits", sm => sm.Field(p => p.NumberOfCommits))
.MovingAverage("commits_moving_avg", mv => mv
Expand All @@ -76,7 +76,7 @@ public MovingAverageHoltLinearAggregationUsageTests(ReadOnlyCluster cluster, End
{
Field = "startedOn",
Interval = DateInterval.Month,
MinimumDocumentCount = 1,
MinimumDocumentCount = 0,
Aggregations =
new SumAggregation("commits", "numberOfCommits")
&& new MovingAverageAggregation("commits_moving_avg", "commits")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public MovingAverageHoltWintersUsageTests(ReadOnlyCluster cluster, EndpointUsage
{
field = "startedOn",
interval = "month",
min_doc_count = 1
min_doc_count = 0
},
aggs = new
{
Expand Down Expand Up @@ -60,7 +60,7 @@ public MovingAverageHoltWintersUsageTests(ReadOnlyCluster cluster, EndpointUsage
.DateHistogram("projects_started_per_month", dh => dh
.Field(p => p.StartedOn)
.Interval(DateInterval.Month)
.MinimumDocumentCount(1)
.MinimumDocumentCount(0)
.Aggregations(aa => aa
.Sum("commits", sm => sm
.Field(p => p.NumberOfCommits)
Expand All @@ -87,7 +87,7 @@ public MovingAverageHoltWintersUsageTests(ReadOnlyCluster cluster, EndpointUsage
{
Field = "startedOn",
Interval = DateInterval.Month,
MinimumDocumentCount = 1,
MinimumDocumentCount = 0,
Aggregations =
new SumAggregation("commits", "numberOfCommits")
&& new MovingAverageAggregation("commits_moving_avg", "commits")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public MovingAverageLinearAggregationUsageTests(ReadOnlyCluster cluster, Endpoin
{
field = "startedOn",
interval = "month",
min_doc_count = 0
},
aggs = new
{
Expand Down Expand Up @@ -52,6 +53,7 @@ public MovingAverageLinearAggregationUsageTests(ReadOnlyCluster cluster, Endpoin
.DateHistogram("projects_started_per_month", dh => dh
.Field(p => p.StartedOn)
.Interval(DateInterval.Month)
.MinimumDocumentCount(0)
.Aggregations(aa => aa
.Sum("commits", sm => sm
.Field(p => p.NumberOfCommits)
Expand All @@ -71,6 +73,7 @@ public MovingAverageLinearAggregationUsageTests(ReadOnlyCluster cluster, Endpoin
{
Field = "startedOn",
Interval = DateInterval.Month,
MinimumDocumentCount = 0,
Aggregations =
new SumAggregation("commits", "numberOfCommits") &&
new MovingAverageAggregation("commits_moving_avg", "commits")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public MovingAverageSimpleAggregationUsageTests(ReadOnlyCluster cluster, Endpoin
date_histogram = new
{
field = "startedOn",
interval = "month"
interval = "month",
min_doc_count = 0
},
aggs = new
{
Expand Down Expand Up @@ -54,6 +55,7 @@ public MovingAverageSimpleAggregationUsageTests(ReadOnlyCluster cluster, Endpoin
.DateHistogram("projects_started_per_month", dh => dh
.Field(p => p.StartedOn)
.Interval(DateInterval.Month)
.MinimumDocumentCount(0)
.Aggregations(aa => aa
.Sum("commits", sm => sm
.Field(p => p.NumberOfCommits)
Expand All @@ -75,6 +77,7 @@ public MovingAverageSimpleAggregationUsageTests(ReadOnlyCluster cluster, Endpoin
{
Field = "startedOn",
Interval = DateInterval.Month,
MinimumDocumentCount = 0,
Aggregations =
new SumAggregation("commits", "numberOfCommits")
&& new MovingAverageAggregation("commits_moving_avg", "commits")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public MovingFunctionAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsag
{
field = "startedOn",
interval = "month",
min_doc_count = 0
},
aggs = new
{
Expand Down Expand Up @@ -63,6 +64,7 @@ public MovingFunctionAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsag
.DateHistogram("projects_started_per_month", dh => dh
.Field(p => p.StartedOn)
.Interval(DateInterval.Month)
.MinimumDocumentCount(0)
.Aggregations(aa => aa
.Sum("commits", sm => sm
.Field(p => p.NumberOfCommits)
Expand All @@ -81,6 +83,7 @@ public MovingFunctionAggregationUsageTests(ReadOnlyCluster cluster, EndpointUsag
{
Field = "startedOn",
Interval = DateInterval.Month,
MinimumDocumentCount = 0,
Aggregations =
new SumAggregation("commits", "numberOfCommits")
&& new MovingFunctionAggregation("commits_moving_avg", "commits")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public SerialDifferencingAggregationUsageTests(ReadOnlyCluster cluster, Endpoint
{
field = "startedOn",
interval = "month",
min_doc_count = 1
min_doc_count = 0
},
aggs = new
{
Expand Down Expand Up @@ -48,7 +48,7 @@ public SerialDifferencingAggregationUsageTests(ReadOnlyCluster cluster, Endpoint
.DateHistogram("projects_started_per_month", dh => dh
.Field(p => p.StartedOn)
.Interval(DateInterval.Month)
.MinimumDocumentCount(1)
.MinimumDocumentCount(0)
.Aggregations(aa => aa
.Sum("commits", sm => sm
.Field(p => p.NumberOfCommits)
Expand All @@ -65,7 +65,7 @@ public SerialDifferencingAggregationUsageTests(ReadOnlyCluster cluster, Endpoint
{
Field = "startedOn",
Interval = DateInterval.Month,
MinimumDocumentCount = 1,
MinimumDocumentCount = 0,
Aggregations =
new SumAggregation("commits", "numberOfCommits")
&& new SerialDifferencingAggregation("second_difference", "commits")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public TermsLookupQueryUsageTests(ReadOnlyCluster cluster, EndpointUsage usage)
Field = "description",
TermsLookup = new FieldLookup
{
Id = 12,
Id = "12",
Index = Index<Developer>(),
Path = Field<Developer>(p => p.LastName),
Routing = "myroutingvalue"
Expand All @@ -41,7 +41,7 @@ public TermsLookupQueryUsageTests(ReadOnlyCluster cluster, EndpointUsage usage)
boost = 1.1,
description = new
{
id = 12,
id = "12",
index = "devs",
path = "lastName",
routing = "myroutingvalue"
Expand All @@ -56,7 +56,7 @@ protected override QueryContainer QueryFluent(QueryContainerDescriptor<Project>
.Field(p => p.Description)
.TermsLookup<Developer>(e => e
.Path(p => p.LastName)
.Id(12)
.Id("12")
.Routing("myroutingvalue")
)
);
Expand Down
9 changes: 1 addition & 8 deletions tests/Tests/Search/SearchTemplate/SearchTemplateApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,6 @@ protected override LazyResponses ClientUsage() => Calls(
(c, r) => c.SearchTemplateAsync<Project>(r)
);

protected override void ExpectResponse(ISearchResponse<Project> response)
{
response.ServerError.Should().NotBeNull();
if (TestConfiguration.Instance.ElasticsearchVersion < "7.7.0")
response.ServerError.Error.Reason.Should().Contain("no [query]");
else
response.ServerError.Error.Reason.Should().Contain("unknown query [atch]");
}
protected override void ExpectResponse(ISearchResponse<Project> response) => response.ServerError.Should().NotBeNull();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe

response.ServerError.Error.Reason.Should().Contain("query");

for both? It would provide a slightly stronger assertion for why there is an error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just conscious that binding the test to the error message probably isn't a good idea as the error message can change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a fair point, historically verifiable! Is there some other way we can assert that the error is related to what we expect it to be?

}
}