Skip to content

Commit

Permalink
Fix failing test (#20634)
Browse files Browse the repository at this point in the history
* Fix failing test

* Fix failing test

* Fix failing test

* Fix failing test

* Fix failing test

* Fix failing test

* Fix failing test

* Fix failing test

* Fix failing test

* comment

* comment
  • Loading branch information
rodireich authored Dec 20, 2022
1 parent a55eb7d commit 401aa44
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import io.airbyte.integrations.standardtest.source.TestDataHolder;
import io.airbyte.integrations.standardtest.source.TestDestinationEnv;
import io.airbyte.protocol.models.JsonSchemaType;
import java.math.BigDecimal;
import org.jooq.DSLContext;
import org.jooq.SQLDialect;
import org.testcontainers.containers.Db2Container;
Expand Down Expand Up @@ -126,7 +127,7 @@ protected void initTests() {
.airbyteType(JsonSchemaType.NUMBER)
.fullSourceDataType("DECIMAL(31, 0)")
.addInsertValues("null", "1", "DECIMAL((-1 + 10E+29), 31, 0)", "DECIMAL((1 - 10E+29), 31, 0)")
.addExpectedValues(null, "1", "1.0E30", "-1.0E30")
.addExpectedValues(null, "1", "%.0f".formatted(Double.valueOf("1.0E30")), "%.0f".formatted(Double.valueOf("-1.0E30")))
.build());
addDataTypeTestData(
TestDataHolder.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ protected void initTests() {
.sourceType("NUMBER")
.airbyteType(JsonSchemaType.NUMBER)
.addInsertValues("null", "1", "123.45", "power(10, -130)", "9.99999999999999999999 * power(10, 125)")
.addExpectedValues(null, "1", "123.45", String.valueOf(Math.pow(10, -130)), String.valueOf(9.99999999999999999999 * Math.pow(10, 125)))
/* The 999990000… below is the plain string representation of 9.999 * power(10, 125) */
/* because normalization expects a plain integer strings whereas `Math.pow(10, 125)` returns a scientific notation */
.addExpectedValues(null, "1", "123.45", String.valueOf(Math.pow(10, -130)),
"999999999999999999999000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
.build());

addDataTypeTestData(
Expand All @@ -155,7 +158,7 @@ protected void initTests() {
.airbyteType(JsonSchemaType.NUMBER)
.fullSourceDataType("NUMBER(6,-2)")
.addInsertValues("123.89")
.addExpectedValues("100.0")
.addExpectedValues("100")
.build());

addDataTypeTestData(
Expand All @@ -164,7 +167,7 @@ protected void initTests() {
.airbyteType(JsonSchemaType.NUMBER)
.fullSourceDataType("FLOAT(5)")
.addInsertValues("1.34", "126.45")
.addExpectedValues("1.3", "130.0")
.addExpectedValues("1.3", "130")
.build());

addDataTypeTestData(
Expand Down

0 comments on commit 401aa44

Please sign in to comment.