Skip to content

Commit 575b71d

Browse files
Skip DateHistogram aggregations for <7.2.0 (#4943) (#4946)
This commit skips running DateHistogram aggregations for versions <7.2.0 as they use calendar_interval and fixed_interval, which were introduced in 7.2.0. Co-authored-by: Russ Cam <russ.cam@elastic.co>
1 parent b54940d commit 575b71d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/Tests/Aggregations/Bucket/DateHistogram/DateHistogramAggregationUsageTests.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information
44

5-
using System;
5+
using System;
66
using System.Linq;
7+
using Elastic.Elasticsearch.Xunit.XunitPlumbing;
78
using FluentAssertions;
89
using Nest;
910
using Tests.Core.Extensions;
@@ -26,6 +27,7 @@ namespace Tests.Aggregations.Bucket.DateHistogram
2627
*
2728
* Be sure to read the Elasticsearch documentation on {ref_current}/search-aggregations-bucket-datehistogram-aggregation.html[Date Histogram Aggregation].
2829
*/
30+
[SkipVersion("<7.2.0", "Uses calendar_interval which was introduced in 7.2.0")]
2931
public class DateHistogramAggregationUsageTests : ProjectsOnlyAggregationUsageTestBase
3032
{
3133
public DateHistogramAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }
@@ -68,7 +70,6 @@ public DateHistogramAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage
6870
}
6971
};
7072

71-
#pragma warning disable 618, 612
7273
protected override Func<AggregationContainerDescriptor<Project>, IAggregationContainer> FluentAggs => a => a
7374
.DateHistogram("projects_started_per_month", date => date
7475
.Field(p => p.StartedOn)
@@ -111,7 +112,6 @@ public DateHistogramAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage
111112
}
112113
}
113114
};
114-
#pragma warning restore 618, 612
115115

116116
protected override void ExpectResponse(ISearchResponse<Project> response)
117117
{
@@ -141,6 +141,7 @@ protected override void ExpectResponse(ISearchResponse<Project> response)
141141
}
142142

143143
// hide
144+
[SkipVersion("<7.2.0", "Uses fixed_interval which was introduced in 7.2.0")]
144145
public class DateHistogramAggregationNoSubAggregationsUsageTests : ProjectsOnlyAggregationUsageTestBase
145146
{
146147
public DateHistogramAggregationNoSubAggregationsUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }
@@ -166,7 +167,6 @@ public DateHistogramAggregationNoSubAggregationsUsageTests(ReadOnlyCluster i, En
166167
}
167168
};
168169

169-
#pragma warning disable 618, 612
170170
protected override Func<AggregationContainerDescriptor<Project>, IAggregationContainer> FluentAggs => a => a
171171
.DateHistogram("projects_started_per_four_weeks", date => date
172172
.Field(p => p.StartedOn)
@@ -193,7 +193,6 @@ public DateHistogramAggregationNoSubAggregationsUsageTests(ReadOnlyCluster i, En
193193
Order = HistogramOrder.CountAscending,
194194
Missing = FixedDate
195195
};
196-
#pragma warning restore 618, 612
197196

198197
protected override void ExpectResponse(ISearchResponse<Project> response)
199198
{

0 commit comments

Comments
 (0)