-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Thomas Farr <tsfarr@amazon.com>
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* 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 OpenSearch.OpenSearch.Xunit.XunitPlumbing; | ||
using Tests.Core.Extensions; | ||
using Tests.Core.ManagedOpenSearch.Clusters; | ||
|
||
namespace Tests.Reproduce | ||
{ | ||
/// <summary> | ||
/// Parsing histogram interval failed: <a href="https://github.com/opensearch-project/opensearch-net/issues/130">Issue #130</a> | ||
/// </summary> | ||
/// | ||
public class GitHubIssue130 : IClusterFixture<ReadOnlyCluster> | ||
{ | ||
private readonly ReadOnlyCluster _cluster; | ||
|
||
public GitHubIssue130(ReadOnlyCluster cluster) => _cluster = cluster; | ||
|
||
[U] public void CanDeserializeDateHistogramBucket() | ||
{ | ||
var response = _cluster.Client.Search<MetricInstance>(c => c | ||
.Index("metrics") | ||
.Size(0) | ||
.Query(q => q.MatchAll()) | ||
.Aggregations(a => a.Histogram("aggregation_ranges", r => r | ||
.Field(f => f.Timestamp) | ||
.Interval(5000) | ||
) | ||
) | ||
); | ||
|
||
response.ShouldBeSuccess(); | ||
} | ||
|
||
// ReSharper disable once ClassNeverInstantiated.Local | ||
private class MetricInstance | ||
{ | ||
// ReSharper disable once UnusedAutoPropertyAccessor.Local | ||
public DateTime Timestamp { get; set; } | ||
} | ||
} | ||
} |