From 916e503008ecd9b54090cfd5de293188a0df9745 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Fri, 6 Jan 2023 16:08:24 +1300 Subject: [PATCH] Reproduce issue Signed-off-by: Thomas Farr --- tests/Tests.Reproduce/GitHubIssue130.cs | 44 +++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/Tests.Reproduce/GitHubIssue130.cs diff --git a/tests/Tests.Reproduce/GitHubIssue130.cs b/tests/Tests.Reproduce/GitHubIssue130.cs new file mode 100644 index 0000000000..7f0236667c --- /dev/null +++ b/tests/Tests.Reproduce/GitHubIssue130.cs @@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ + +using System; +using System.Linq; +using System.Threading; +using OpenSearch.Client; +using OpenSearch.OpenSearch.Xunit.XunitPlumbing; +using Tests.Core.Extensions; +using Tests.Core.ManagedOpenSearch.Clusters; +using Tests.Domain; + +namespace Tests.Reproduce +{ + /// + /// Parsing histogram interval failed: Issue #130 + /// + /// + public class GitHubIssue130 : IClusterFixture + { + private readonly WritableCluster _cluster; + + public GitHubIssue130(WritableCluster cluster) => _cluster = cluster; + + [I] public void CanDeserializeDateHistogramBucket() + { + var response = _cluster.Client.Search(c => c + .Size(0) + .Query(q => q.MatchAll()) + .Aggregations(a => a.Histogram("aggregation_ranges", r => r + .Field(f => f.LastActivity) + .Interval(5000) + ) + ) + ); + + response.ShouldBeValid(); + } + } +}