opensearch-project/OpenSearch
在 GitHub 查看[Feature Request] support tolerance in yaml rest test
Open
#18,213 创建于 2025年5月6日
Otherenhancementgood first issue
描述
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