Skip to content

Commit

Permalink
Update unsigned_long API specification tests baseline to 2.8.0 (opens…
Browse files Browse the repository at this point in the history
…earch-project#7481) (opensearch-project#7487)

(cherry picked from commit 0d3c61d)

Signed-off-by: Andriy Redko <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 47a3d8a commit ec271f7
Show file tree
Hide file tree
Showing 22 changed files with 369 additions and 54 deletions.
5 changes: 4 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,9 @@ 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 +215,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 ec271f7

Please sign in to comment.