Skip to content

Commit

Permalink
Reproduce issue
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <tsfarr@amazon.com>
  • Loading branch information
Xtansia committed Jan 6, 2023
1 parent e76fc2e commit eb8b346
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/Tests.Reproduce/GitHubIssue130.cs
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; }
}
}
}

0 comments on commit eb8b346

Please sign in to comment.