ISSUE #23281 - changed passed/failed[Rows] to Long to handle 64-bits numbers (#23325)

* fix: changed passed/failed[Rows] to Long to handle 64-bits numbers

* fix: failing test case
This commit is contained in:
Teddy 2025-09-16 08:38:33 +02:00 committed by GitHub
parent 4f267d482e
commit dad07bc7fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 92 additions and 4 deletions

View File

@ -4041,4 +4041,88 @@ public class TestCaseResourceTest extends EntityResourceTest<TestCase, CreateTes
"List endpoint should also filter by createdBy");
}
}
@Test
void test_testCaseResult_64bitIntegerFields(TestInfo testInfo)
throws IOException, ParseException {
CreateTestCase create =
createRequest(testInfo)
.withEntityLink(TABLE_LINK)
.withTestDefinition(TEST_DEFINITION4.getFullyQualifiedName())
.withParameterValues(
List.of(new TestCaseParameterValue().withValue("100").withName("maxValue")));
TestCase testCase = createAndCheckEntity(create, ADMIN_AUTH_HEADERS);
long maxInt64PassedRows = Long.MAX_VALUE; // 9,223,372,036,854,775,807
long maxInt64FailedRows = Long.MAX_VALUE - 1000; // Close to max but different
long largePassedRows = 3_000_000_000L;
long largeFailedRows = 5_000_000_000L;
CreateTestCaseResult createTestCaseResult =
new CreateTestCaseResult()
.withResult("tested with 64-bit integers")
.withTestCaseStatus(TestCaseStatus.Success)
.withTimestamp(TestUtils.dateToTimestamp("2021-09-09"))
.withPassedRows(largePassedRows)
.withFailedRows(largeFailedRows);
TestCaseResult result =
postTestCaseResult(
testCase.getFullyQualifiedName(), createTestCaseResult, ADMIN_AUTH_HEADERS);
assertEquals(
largePassedRows, result.getPassedRows(), "Passed rows should match the large 64-bit value");
assertEquals(
largeFailedRows, result.getFailedRows(), "Failed rows should match the large 64-bit value");
CreateTestCaseResult maxValueTestCaseResult =
new CreateTestCaseResult()
.withResult("tested with maximum 64-bit integers")
.withTestCaseStatus(TestCaseStatus.Failed)
.withTimestamp(TestUtils.dateToTimestamp("2021-09-10"))
.withPassedRows(maxInt64PassedRows)
.withFailedRows(maxInt64FailedRows);
TestCaseResult maxValueResult =
postTestCaseResult(
testCase.getFullyQualifiedName(), maxValueTestCaseResult, ADMIN_AUTH_HEADERS);
assertEquals(
maxInt64PassedRows,
maxValueResult.getPassedRows(),
"Passed rows should match the maximum 64-bit value");
assertEquals(
maxInt64FailedRows,
maxValueResult.getFailedRows(),
"Failed rows should match the maximum 64-bit value");
CreateTestCaseResult zeroValueTestCaseResult =
new CreateTestCaseResult()
.withResult("tested with zero values")
.withTestCaseStatus(TestCaseStatus.Success)
.withTimestamp(TestUtils.dateToTimestamp("2021-09-11"))
.withPassedRows(0L)
.withFailedRows(0L);
TestCaseResult zeroValueResult =
postTestCaseResult(
testCase.getFullyQualifiedName(), zeroValueTestCaseResult, ADMIN_AUTH_HEADERS);
assertEquals(0L, zeroValueResult.getPassedRows(), "Passed rows should be zero");
assertEquals(0L, zeroValueResult.getFailedRows(), "Failed rows should be zero");
CreateTestCaseResult nullValueTestCaseResult =
new CreateTestCaseResult()
.withResult("tested with null values")
.withTestCaseStatus(TestCaseStatus.Success)
.withTimestamp(TestUtils.dateToTimestamp("2021-09-12"));
TestCaseResult nullValueResult =
postTestCaseResult(
testCase.getFullyQualifiedName(), nullValueTestCaseResult, ADMIN_AUTH_HEADERS);
assertNull(nullValueResult.getPassedRows(), "Passed rows should be null when not set");
assertNull(nullValueResult.getFailedRows(), "Failed rows should be null when not set");
}
}

View File

@ -34,11 +34,13 @@
},
"passedRows": {
"description": "Number of rows that passed.",
"type": "integer"
"type": "integer",
"existingJavaType": "java.lang.Long"
},
"failedRows": {
"description": "Number of rows that failed.",
"type": "integer"
"type": "integer",
"existingJavaType": "java.lang.Long"
},
"passedRowsPercentage": {
"description": "Percentage of rows that passed.",

View File

@ -144,11 +144,13 @@
},
"passedRows": {
"description": "Number of rows that passed.",
"type": "integer"
"type": "integer",
"existingJavaType": "java.lang.Long"
},
"failedRows": {
"description": "Number of rows that failed.",
"type": "integer"
"type": "integer",
"existingJavaType": "java.lang.Long"
},
"passedRowsPercentage": {
"description": "Percentage of rows that passed.",