Skip to content

Commit

Permalink
Update unsigned_long API specification tests baseline to 2.8.0 (#7481)
Browse files Browse the repository at this point in the history
Signed-off-by: Andriy Redko <[email protected]>
(cherry picked from commit 0d3c61d)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Signed-off-by: Andriy Redko <[email protected]>
  • Loading branch information
github-actions[bot] authored and reta committed May 10, 2023
1 parent b69e08d commit d3a020e
Show file tree
Hide file tree
Showing 22 changed files with 367 additions and 54 deletions.
3 changes: 2 additions & 1 deletion libs/common/src/main/java/org/opensearch/common/Numbers.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public static BigInteger toUnsignedLongExact(Number value) {
private static BigDecimal BIGDECIMAL_GREATER_THAN_LONG_MAX_VALUE = BigDecimal.valueOf(Long.MAX_VALUE).add(BigDecimal.ONE);
private static BigDecimal BIGDECIMAL_LESS_THAN_LONG_MIN_VALUE = BigDecimal.valueOf(Long.MIN_VALUE).subtract(BigDecimal.ONE);
private static BigDecimal BIGDECIMAL_GREATER_THAN_USIGNED_LONG_MAX_VALUE = new BigDecimal(MAX_UNSIGNED_LONG_VALUE).add(BigDecimal.ONE);
private static BigDecimal BIGDECIMAL_LESS_THAN_USIGNED_LONG_MIN_VALUE = new BigDecimal(MIN_UNSIGNED_LONG_VALUE).subtract(BigDecimal.ONE);

/** Return the long that {@code stringValue} stores or throws an exception if the
* stored value cannot be converted to a long that stores the exact same
Expand Down Expand Up @@ -212,7 +213,7 @@ public static BigInteger toUnsignedLong(String stringValue, boolean coerce) {
try {
BigDecimal bigDecimalValue = new BigDecimal(stringValue);
if (bigDecimalValue.compareTo(BIGDECIMAL_GREATER_THAN_USIGNED_LONG_MAX_VALUE) >= 0
|| bigDecimalValue.compareTo(BigDecimal.ZERO) <= 0) {
|| bigDecimalValue.compareTo(BIGDECIMAL_LESS_THAN_USIGNED_LONG_MIN_VALUE) <= 0) {
throw new IllegalArgumentException("Value [" + stringValue + "] is out of range for an unsigned long");
}
bigIntegerValue = coerce ? bigDecimalValue.toBigInteger() : bigDecimalValue.toBigIntegerExact();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
setup:
- skip:
version: " - 2.99.99"
reason: unsigned_long is not supported before 3.0.0
version: " - 2.7.99"
reason: unsigned_long is not supported before 2.8.0

- do:
indices.create:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
setup:
- skip:
version: " - 2.99.99"
reason: unsigned_long is not supported before 3.0.0
version: " - 2.7.99"
reason: unsigned_long is not supported before 2.8.0

- do:
indices.create:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
setup:
- skip:
version: " - 2.99.99"
reason: unsigned_long is not supported before 3.0.0
version: " - 2.7.99"
reason: unsigned_long is not supported before 2.8.0

- do:
indices.create:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
setup:
- skip:
version: " - 2.99.99"
reason: unsigned_long is not supported before 3.0.0
version: " - 2.7.99"
reason: unsigned_long is not supported before 2.8.0

- do:
indices.create:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
setup:
- skip:
version: " - 2.99.99"
reason: unsigned_long is not supported before 3.0.0
version: " - 2.7.99"
reason: unsigned_long is not supported before 2.8.0

- do:
indices.create:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
setup:
- skip:
version: " - 2.99.99"
reason: unsigned_long is not supported before 3.0.0
version: " - 2.7.99"
reason: unsigned_long is not supported before 2.8.0

- do:
indices.create:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
setup:
- skip:
version: " - 2.99.99"
reason: unsigned_long is not supported before 3.0.0
version: " - 2.7.99"
reason: unsigned_long is not supported before 2.8.0

- do:
indices.create:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
setup:
- skip:
version: " - 2.99.99"
reason: unsigned_long is not supported before 3.0.0
version: " - 2.7.99"
reason: unsigned_long is not supported before 2.8.0

- do:
indices.create:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
setup:
- skip:
version: " - 2.99.99"
reason: unsigned_long is not supported before 3.0.0
version: " - 2.7.99"
reason: unsigned_long is not supported before 2.8.0

- do:
indices.create:
Expand Down
Loading

0 comments on commit d3a020e

Please sign in to comment.