opensearch-project/OpenSearch

[Feature Request] support tolerance in yaml rest test

Open

#18.213 aberto em 6 de mai. de 2025

Ver no GitHub
 (4 comments) (1 reaction) (1 assignee)Java (1.505 forks)batch import
Otherenhancementgood first issue

Métricas do repositório

Stars
 (8.123 stars)
Métricas de merge de PR
 (Mesclagem média 5d 9h) (266 fundiu PRs em 30d)

Description

Is your feature request related to a problem? Please describe

It would be better if we can support tolerance/delta when matching a value in yaml rest test

For example, to add a delta on this match

  • match: {aggregations.mfs.fields.2.correlation.val2: 0.9569513137793205}

I need to write in this way

  • gte: {aggregations.mfs.fields.2.correlation.val2: 0.956951313779319}
  • lte: {aggregations.mfs.fields.2.correlation.val2: 0.956951313779321}

https://github.com/opensearch-project/OpenSearch/commit/4a92aa4e14f9db8887499b11765e0c5b375cfc20

Describe the solution you'd like

I see JUnit provides this assertEquals(double expected, double actual, double delta), so we probably can do similar thing in yaml rest test

  • match: {<matching_field>: <match_value>, epsilon: <delta_value>}

In my previous example, this will be

  • match: {aggregations.mfs.fields.2.correlation.val2: 0.9569513137793205, epsilon: 0.000000000000001}

This syntax is better to understand the real intention. Related class to enhance is MatchAssertion.java

Related component

Other

Describe alternatives you've considered

No response

Additional context

No response

Guia do colaborador