Hisoka-X commented on code in PR #7468:
URL: https://github.com/apache/seatunnel/pull/7468#discussion_r1728226745
##########
seatunnel-engine/seatunnel-engine-client/src/test/java/org/apache/seatunnel/engine/client/SeaTunnelClientTest.java:
##########
@@ -684,18 +684,55 @@ public void testGetMultiTableJobMetrics() {
.mapToLong(Map.Entry::getValue)
.sum());
// Instantaneous rates in the same direction are directly added
- Assertions.assertEquals(
- totalCount.get(SOURCE_RECEIVED_QPS),
- tableCount.entrySet().stream()
- .filter(e ->
e.getKey().startsWith(SOURCE_RECEIVED_QPS + "#"))
- .mapToLong(Map.Entry::getValue)
- .sum());
- Assertions.assertEquals(
- totalCount.get(SINK_WRITE_QPS),
- tableCount.entrySet().stream()
- .filter(e -> e.getKey().startsWith(SINK_WRITE_QPS
+ "#"))
- .mapToLong(Map.Entry::getValue)
- .sum());
+ // The size does not fluctuate more than %2 of the total value
+ Assertions.assertTrue(
+ Math.abs(
+ totalCount.get(SOURCE_RECEIVED_QPS)
+ - tableCount.entrySet().stream()
+ .filter(
+ e ->
+ e.getKey()
+
.startsWith(
+
SOURCE_RECEIVED_QPS))
Review Comment:
We need this to filter table metrics.
##########
seatunnel-engine/seatunnel-engine-client/src/test/java/org/apache/seatunnel/engine/client/SeaTunnelClientTest.java:
##########
@@ -684,18 +684,55 @@ public void testGetMultiTableJobMetrics() {
.mapToLong(Map.Entry::getValue)
.sum());
// Instantaneous rates in the same direction are directly added
- Assertions.assertEquals(
- totalCount.get(SOURCE_RECEIVED_QPS),
- tableCount.entrySet().stream()
- .filter(e ->
e.getKey().startsWith(SOURCE_RECEIVED_QPS + "#"))
- .mapToLong(Map.Entry::getValue)
- .sum());
- Assertions.assertEquals(
- totalCount.get(SINK_WRITE_QPS),
- tableCount.entrySet().stream()
- .filter(e -> e.getKey().startsWith(SINK_WRITE_QPS
+ "#"))
- .mapToLong(Map.Entry::getValue)
- .sum());
+ // The size does not fluctuate more than %2 of the total value
+ Assertions.assertTrue(
+ Math.abs(
+ totalCount.get(SOURCE_RECEIVED_QPS)
+ - tableCount.entrySet().stream()
+ .filter(
+ e ->
+ e.getKey()
+
.startsWith(
+
SOURCE_RECEIVED_QPS))
Review Comment:
```suggestion
SOURCE_RECEIVED_QPS + "#"))
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]